Thanks for the advice and discussion, Rick! Agreed that relying on error message strings is not desirable in the long term and that we should pursue a proper standardized solution in parallel. I have filed the specification issue and the Chromium tracking bug to follow up on this: - https://github.com/w3c/ServiceWorker/issues/1857 - https://crbug.com/584629540
On Wed, Nov 11, 2026 at 11:33 PM Rick Byers <[email protected]> wrote: > I just chatted with Shunya about this. My advice was: > > - We really should not encourage sites to rely on error message > strings. If there's a need to differentiate error messages, let's define a > proper API for it > - Whether that's a different error type, or a new property > somewhere is a detail to work out in the standards process > - At the same time, there is already a history of sites > (unfortunately) relying on on error message to differentiate different > implementation details of network errors when we have failed to give them > any better alternative. > > Given that there is an urgent developer need to differentiate this case, > and the compat risk is low (service worker static routes are new and rarely > used), I am ok with a temporary hack to change the error message string, > provided we will also pursue a proper fix over the next couple of months. > Even if we can't convince other browsers to differentiate this case, we > should at least have a PR we can point at for why Chrome behaves > differently. > > Rick > > On Wed, Nov 11, 2026 at 2:58 AM Chromestatus < > [email protected]> wrote: > >> *Contact emails* >> [email protected] >> >> *Explainer* >> https://crbug.com/584504247 >> >> *Specification* >> >> https://w3c.github.io/ServiceWorker/#dom-routersourceenum-race-network-and-fetch-handler >> >> *Summary* >> When a Service Worker matches a Static Routing rule with >> 'race-network-and-fetch-handler' and calls fetch(event.request) inside its >> fetch handler, Chromium deduplicates the network request. If that raced >> request is cancelled before response headers arrive (net::ERR_ABORTED)—for >> example, when an offline fallback timer resolves event.respondWith() first >> or the navigation is aborted—Chromium now rejects the fetch(event.request) >> promise with TypeError("The service worker race-network-and-fetch-handler >> request was cancelled before 'fetch()' settled.") instead of the generic >> TypeError("Failed to fetch"). This matches Service Worker Navigation >> Preload (event.preloadResponse) and allows web applications to distinguish >> expected pre-settlement race cancellations from genuine network errors. >> Note: This is a small behavioral refinement to the already-shipped Service >> Worker Static Routing API with no IDL or specification changes. Because web >> applications may observe the updated TypeError message string, we are >> sending an Intent to Ship directly for web compatibility review. >> >> *Blink component* >> Blink>ServiceWorker >> <https://issues.chromium.org/issues?q=customfield1222907:%22Blink%3EServiceWorker%22> >> >> *Web Feature ID* >> service-workers-static-routes >> <https://webstatus.dev/features/service-workers-static-routes> >> >> *Motivation* >> In Service Worker Navigation Preload (event.preloadResponse), Chromium >> already distinguishes pre-settlement cancellation (net::ERR_ABORTED) from >> genuine network failures by rejecting event.preloadResponse with "The >> service worker navigation preload request was cancelled before >> 'preloadResponse' settled.". Offline-capable web applications migrating >> from Navigation Preload to Static Routing >> ('race-network-and-fetch-handler') inspect this cancellation message to >> suppress expected cancellation noise in client error telemetry while still >> alerting on genuine network outages. Because >> 'race-network-and-fetch-handler' currently collapses net::ERR_ABORTED into >> TypeError("Failed to fetch"), migrating causes false-positive network error >> spikes and triggers unnecessary offline fallback paths. >> >> *Initial public proposal* >> *No information provided* >> >> *TAG review* >> *No information provided* >> >> *TAG review status* >> Not applicable >> >> *Goals for experimentation* >> None >> >> *Risks* >> >> >> *Interoperability and Compatibility* >> Low. Fetch only specifies rejecting the promise with a TypeError on >> network errors, and Web IDL explicitly leaves simple exception message >> strings implementation-defined. Browser engines already use distinct >> TypeError messages for fetch() failures. This change only affects fetch() >> calls inside a Service Worker that match a 'race-network-and-fetch-handler' >> rule and fail specifically with net::ERR_ABORTED prior to response headers. >> >> *Gecko*: No signal >> >> *WebKit*: No signal >> >> *Web developers*: Positive Requested by web applications migrating from >> Navigation Preload to Service Worker Static Routing >> 'race-network-and-fetch-handler'. >> >> *Other signals*: >> >> *WebView application risks* >> >> Does this intent deprecate or change behavior of existing APIs, such that >> it has potentially high risk for Android WebView-based applications? >> None >> >> >> *Debuggability* >> Improves debuggability for developers using Service Worker Static Routing >> ('race-network-and-fetch-handler') by distinguishing pre-settlement request >> cancellation from genuine network failures in console logs and exception >> handlers, matching Navigation Preload. >> >> *Will this feature be supported on all six Blink platforms (Windows, Mac, >> Linux, ChromeOS, Android, and Android WebView)?* >> Yes >> >> *Is this feature fully tested by web-platform-tests >> <https://chromium.googlesource.com/chromium/src/+/main/docs/testing/web_platform_tests.md>?* >> No >> Because TypeError message strings are implementation-defined and vary >> across browser engines, WPT only asserts the exception type. Tested in >> Chromium browser tests >> (content/browser/service_worker/service_worker_browsertest.cc) and Blink >> unit tests >> (third_party/blink/renderer/modules/service_worker/service_worker_global_scope_test.cc). >> >> >> *Flag name on about://flags* >> *No information provided* >> >> *Finch feature name* >> ServiceWorkerRaceNetworkRequestAbortedErrorMessage >> >> *Rollout plan* >> Will ship enabled for all users >> >> *Requires code in //chrome?* >> False >> >> *Tracking bug* >> https://crbug.com/584504247 >> >> *Estimated milestones* >> Shipping on desktop 159 >> Shipping on Android 159 >> Shipping on WebView 159 >> >> *Anticipated spec changes* >> >> Open questions about a feature may be a source of future web compat or >> interop issues. Please list open issues (e.g. links to known github issues >> in the project for the feature specification) whose resolution may >> introduce web compat/interop risk (e.g., changing to naming or structure of >> the API in a non-backward-compatible way). >> None. The fetch spec (https://fetch.spec.whatwg.org/#dom-global-fetch) >> only specifies rejecting the promise with a TypeError on network errors, >> and Web IDL (https://webidl.spec.whatwg.org/#dfn-create-exception) >> explicitly leaves simple exception message strings implementation-defined. >> >> *Link to entry on the Chrome Platform Status* >> https://chromestatus.com/feature/5124748525830144?gate=6639049170354176 >> >> This intent message was generated by Chrome Platform Status >> <https://chromestatus.com>. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "blink-dev" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion visit >> https://groups.google.com/a/chromium.org/d/msgid/blink-dev/6af42035.c4d90b0f.20186.0030.GAE%40google.com >> <https://groups.google.com/a/chromium.org/d/msgid/blink-dev/6af42035.c4d90b0f.20186.0030.GAE%40google.com?utm_medium=email&utm_source=footer> >> . >> > -- You received this message because you are subscribed to the Google Groups "blink-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAGMyg-acTGtVSYOPpDoGa94_eR9fpUcvkgvjJrMmWsEcov3WLg%40mail.gmail.com.
