#4078·htmx

[htmx4] SSE unhandled AbortError when closing on the configured event

Author: raxeloCreated Sep 16, 2026Updated Sep 16, 2026

With htmx 4.0.0 and its bundled SSE extension, receiving the configured close event closes the connection but also produces an unhandled promise rejection.

xml
<div hx-sse:connect="/events" hx-sse:close="done"></div>

The endpoint responds with Content-Type: text/event-stream, writes event: done\ndata: Complete\n\n, and leaves the response open.

Expected: receiving done closes the connection without an unhandled error.

Actual: the connection closes, followed by:

Uncaught (in promise) AbortError: BodyStreamBuffer was aborted

Reproduced with htmx 4.0.0, but not with htmx 2.0.10 + htmx-ext-sse 2.2.4.

Repro on StackBlitz