EventSource keeps reconnecting (error event / server closes stream)
The browser's EventSource reconnects again and again, hammering the server.
EventSource's response has a MIME type that is not "text/event-stream". Aborting the connection.EventSource connection keeps reconnectingEventSource failed: Last-Event-IDEventSource reconnecting loopnet::ERR_INCOMPLETE_CHUNKED_ENCODING EventSource Meaning
Any closed connection or non-200/wrong Content-Type response triggers an automatic reconnect (default 3 s). Return Content-Type: text/event-stream with status 200, keep the connection open with heartbeats, honour retry: and id: / Last-Event-ID, and send 204 to stop reconnecting.
Common causes
- Wrong Content-Type or status code
- Server/proxy closes the stream after a timeout
- Auth failure returning 401/redirect
- App crashes between events
- Short
retryvalue
⚡ Quick fix
- Send
Content-Type: text/event-streamand keep it open - Heartbeat comments every 15–30 s
- Return 204 to stop clients permanently
Detailed fix by platform
JavaScript
- javascript
const es = new EventSource("/events"); es.onerror = () => console.log("readyState", es.readyState);
How to diagnose
- Status/type — 200 text/event-stream?
- Stream — Closed by timeout?
- Auth — Valid?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in HTTP
Other ways to find it
Where this error sits
Origin: Network. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 18 Nov 2026