August 19, 2026 · Cloudflare
Workers - Spec-compliant dispatchEvent() exception handling
A new compatibility flag, spec_compliant_dispatch_exceptions, aligns the Workers runtime's event dispatch behavior with the DOM specification ↗︎. This flag becomes the default for all Workers with a compatibility date of 2026-09-15 or later.
Previously, when an event listener threw an exception during dispatchEvent(), the runtime propagated the exception immediately and skipped all remaining listeners for that event. The spec instead requires that listener exceptions are reported (via the global error event and the console) without interrupting the dispatch — remaining listeners still run.
This change affects the JS-visible dispatchEvent(), AbortSignal abort dispatch, and runtime-fired events on WebSocket, EventSource, and MessagePort. Top-level event delivery for legacy Service Worker syntax entry points (such as addEventListener("fetch", ...)) is not affected.
To opt in before the default date, add spec_compliant_dispatch_exceptions to your compatibility_flags. To preserve the old behavior after the default date, use no_spec_compliant_dispatch_exceptions.
For more details, refer to the compatibility flags documentation.