{"record":{"id":"1d09771a4e0234ac","repo":"chenhg5/cc-connect","slug":"sse-disconnected-reconnecting","errorCode":null,"errorMessage":"SSE disconnected, reconnecting","messagePattern":"SSE disconnected, reconnecting","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agent/reasonix/session.go","lineNumber":277,"sourceCode":"\n\t\tslog.Info(\"reasonix: SSE connected\")\n\t\ts.alive.Store(true)\n\t\tbackoff = 1 * time.Second // reset backoff on successful connection\n\t\ts.reconnectCount = 0      // reset reconnect count on successful connection\n\t\ts.readSSE(ctx, resp.Body)\n\t\t_ = resp.Body.Close()\n\n\t\t// Connection dropped; if context is still alive, reconnect\n\t\tif ctx.Err() != nil {\n\t\t\ts.alive.Store(false)\n\t\t\treturn\n\t\t}\n\t\t// If a turn is in progress, unblock Send() with a reconnect error\n\t\tif s.inTurn.Load() {\n\t\t\ts.mu.Lock()\n\t\t\ts.errTurn = fmt.Errorf(\"reasonix: SSE disconnected during turn\")\n\t\t\ts.mu.Unlock()\n\t\t\ts.emit(core.Event{Type: core.EventResult, Done: true, Error: fmt.Errorf(\"SSE disconnected, reconnecting\")})\n\t\t\ts.inTurn.Store(false)\n\t\t\ts.turnDone <- struct{}{}\n\t\t}\n\t\tslog.Warn(\"reasonix: SSE connection lost, reconnecting\", \"backoff\", backoff)\n\n\tretryWait:\n\t\ts.reconnectCount++\n\t\tif s.reconnectCount >= s.maxReconnects {\n\t\t\tslog.Error(\"reasonix: SSE reconnect limit reached, closing session\", \"max\", s.maxReconnects)\n\t\t\ts.alive.Store(false)\n\t\t\tif s.inTurn.Load() {\n\t\t\t\ts.inTurn.Store(false)\n\t\t\t\ts.turnDone <- struct{}{}\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tselect {\n\t\tcase <-ctx.Done():","sourceCodeStart":259,"sourceCodeEnd":295,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/agent/reasonix/session.go#L259-L295","documentation":"An EventError emitted alongside the SSE reconnect path in reasonix readLoop: the event stream disconnected (non-terminal, context still alive) and the client is reconnecting. Informational — the session stays alive and the next connection resumes event delivery.","triggerScenarios":"Thrown at agent/reasonix/session.go:277 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["No action — reconnection is automatic","If frequent, investigate network stability or serve-side idle timeouts","Keep-alive settings on proxies may need adjusting for SSE"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}