File runtime-service-worker.js?v=2 is causing 404 errors. What is loading this and why it's not found?


I just moved client's website from development server to production server. After moving the site I found out that Chrome is loading runtime-service-worker.js?v=2 on every page load and it's fetching and caching files. The file is supposed to be located in the root folder ie. my-site.com/runtime-service-worker.js?v=2, but it's actually not there. So I suppose it's generated dynamically or temporarily copied there.

When it occurs:

This happens only in Chrome and I can get some console output only when logged in. The output is kind of debug output of what the file and the script is doing. But even when not logged in, the site tries to load the file and it gives the 404 error.

This didn't happened when the site was on development server. After the site move I have only done some minor code updates in theme files, URL updates and updated WP and some plugins.

This is an issue because the site has 404 detector against bots trying to find vulnerabilities in outdated plugins. When there's enough 404 errors the IP is being blocked. And now some visitors have been blocked because of this problem. I temporarily disabled the 404 detection until this is resolved.

Console output:

Here's some example of the console output, when being logged in:

RTSW: caching my-site.com/?dm_ajaxCall=true in addition to  my-site.com/

runtime-service-worker.js?v=2:244 RTSW: fetched and cached:
runtime-service-worker.js?v=2:245 my-site.com/ in druntime-v2_35-site-pages-3675989298-2010869941

runtime-service-worker.js?v=2:244 RTSW: got from cache:
runtime-service-worker.js?v=2:245 my-site.com/wp-includes/js/jquery/jquery.min.js?ver=3.5.1
runtime-service-worker.js?v=2:245 my-site.com/wp-includes/js/jquery/jquery-migrate.min.js?ver=3.3.2
runtime-service-worker.js?v=2:245 my-site.com/wp-content/plugins/bt_cost_calculator/jquery.dd.js?ver=5.6
runtime-service-worker.js?v=2:245 my-site.com/wp-content/plugins/woocommerce/assets/js/jquery-blockui/jquery.blockUI.min.js?ver=2.70 

What have I tried so far:

The site is using my own theme and it doesn't include this file or the script. I have disabled every plugin one by one, but no luck.

I tried googling this, but couldn't find any relateble info.

Any help is appreciated.

Edit: Found the reason and workaround solution

Answer is found below.

  • Are you 100% all caching was also disabled when deactivating the plugins? As far as I know, WP does not ship with a file like this, so it must come either from a (must use) plugin or the theme.
    – kero
    Commented Jan 19, 2021 at 9:54
  • 2
    @kero Yes, I double checked the plugins. I managed to find the reason for all this and I'll post the answer here. Commented Jan 19, 2021 at 11:40

1 Answer 1


After doing some research I found the reason causing this.

Before I moved the client's website to its domain, they had their previous website in the old server. As we started using the new website, we started using another server.

It seems that the previous website used Google's Service Worker. My browser (and some others' too) included the cookie from the previous website, which included this Service Worker.

The service worker is unfamiliar to me, but apparently one of its features is that it will try to save website content to the device for offline using. Therefore in my case the browser also tried to load scripts from files that didn't exist anymore. Some of the scripts are loaded from Google's servers but apparently this one file was located on the client's previous server. My broswer loaded the file from cache, so that's why I didn't find it.

Removing the Service Worker cookie in the browser solved the problem, but only in my browser. Now I'm trying to figure out if there's a method to remove the cookie from visitors' browser who visited the previous website. As long as visitors have the Service Worker cookie, their browsers will try to fetch a file that doesn't exist anymore.

  • 2
    Does this answer from SO answer your question on how to remove the service worker programmatically?
    – kero
    Commented Jan 19, 2021 at 11:57
  • 2
    @kero YES! That seems to be the solution for this issue. Thank you, kero. I'll try that. Commented Jan 19, 2021 at 12:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.