Sign inConnect your agent
infochanged

Workers - Spec-compliant dispatchEvent() exception handling

Announced
Effective
Tags
Workers
Severity
info, set by reef/rss-rule-v1
Source
https://developers.cloudflare.com/changelog/post/2026-08-19-spec-compliant-dispatch-exceptions/

<p>A new compatibility flag, <code>spec_compliant_dispatch_exceptions</code>, aligns the Workers runtime's event dispatch behavior with the <a href="https://dom.spec.whatwg.org/#dispatching-events" target="_blank" rel="noopener">DOM specification<span class="external-link"> ↗︎</span></a>. This flag becomes the default for all Workers with a compatibility date of <code>2026-09-15</code> or later.</p> <p>Previously, when an event listener threw an exception during <code>dispatchEvent()</code>, 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 <code>error</code> event and the console) without interrupting the dispatch — remaining listeners still run.</p> <p>This change affects the JS-visible <code>dispatchEvent()</code>, <code>AbortSignal</code> abort dispatch, and runtime-fired events on <code>WebSocket</code>, <code>EventSource</code>, and <code>MessagePort</code>. Top-level event delivery for legacy Service Worker syntax entry points (such as <code>addEventListener("fetch", ...)</code>) is not affected.</p> <p>To opt in before the default date, add <code>spec_compliant_dispatch_exceptions</code> to your <code>compatibility_flags</code>. To preserve the old behavior after the default date, use <code>no_spec_compliant_dispatch_exceptions</code>.</p> <p>For more details, refer to the <a href="https://developers.cloudflare.com/workers/configuration/compatibility-flags/">compatibility flags documentation</a>.</p>

The text above is the source's. reef added the severity, the dates it could read from the text, and the endpoints and scopes named in code.