Error Codes Wiki

Browser Service Worker Errors — Registration, Cache & Update Failures

Warningweb development

Overview

Fix Service Worker errors including registration failure, stale cache serving old content, update stuck in waiting state, and scope misconfiguration.

Key Details

  • Service Workers are background scripts that intercept network requests for offline functionality
  • Registration requires HTTPS (or localhost for development)
  • A common issue: new code deployed but users still see old cached version
  • Service Workers have a lifecycle: install > waiting > activate > running
  • DevTools > Application > Service Workers shows the current state and allows manual control

Common Causes

  • Service Worker not registering: not served over HTTPS, or JS syntax error in SW file
  • Stale content: old Service Worker still serving cached responses from previous deployment
  • Update stuck in waiting: new SW waiting for all tabs to close before activating
  • Cache strategy too aggressive: caching responses that should not be cached
  • Scope too narrow: SW only controls pages within its scope path

Steps

  1. 1Check registration: DevTools > Application > Service Workers — look for errors in status
  2. 2Force update: check 'Update on reload' in DevTools Service Workers panel
  3. 3Skip waiting: in SW code, call self.skipWaiting() in the install event
  4. 4Clear all caches: DevTools > Application > Cache Storage > right-click > Delete
  5. 5Unregister SW: DevTools > Application > Service Workers > Unregister, then hard refresh

Tags

browserservice-workercachepwaoffline

More in Web Development

Frequently Asked Questions

The old Service Worker is still serving cached responses. Implement a proper cache versioning strategy and use skipWaiting() to activate new SW immediately.