v159 · service worker · edge cases & migration

Error taxonomy

The new message is narrow on purpose: Chromium only uses it for net::ERR_ABORTED on the raced, deduplicated request. Everything else that can go wrong under the same route keeps the generic Failed to fetch. Run each situation for real and see which message the worker’s fetch(event.request) produces, what the page saw, and what a version-tolerant classifier concludes.

Registering this feature’s service worker…

Run the situations

Network state: checking…. To exercise the offline row, switch the browser offline (DevTools → Network → Offline, or airplane mode) and run that row on its own.

Same race route, different causes
SituationRunWorker fetch(event.request)Page sawClassifier
No situation run yet.

a classifier that works before and after 159

const RACE_CANCELLED =
  "The service worker race-network-and-fetch-handler request was cancelled before 'fetch()' settled.";

// Inside the fetch handler, you know whether YOU settled respondWith() first.
function classify(error, { answeredFirst }) {
  if (error?.name === "AbortError") return "aborted-by-us";
  if (!(error instanceof TypeError)) return "bug";
  if (error.message === RACE_CANCELLED) return "race-cancelled";     // Chrome 159+: certain
  if (answeredFirst) return "probably-race-cancelled";               // older Chrome: inferred
  return "network-error";
}

Two cautions. TypeError messages are implementation-defined (that is why WPT only asserts the type), so treat the string as a Chromium-specific hint, never as the only way to stay correct. And the inference fallback is a guess — on older Chrome a genuine failure that happens to land after your fallback timer is indistinguishable from a cancellation, which is precisely the ambiguity Chrome 159 removes.

see also