{"record":{"id":"0528216aca9cc7a4","repo":"chenhg5/cc-connect","slug":"sse-connect-w-reconnecting","errorCode":null,"errorMessage":"SSE connect: %w (reconnecting)","messagePattern":"SSE connect: %w \\(reconnecting\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agent/reasonix/session.go","lineNumber":250,"sourceCode":"\t\t\ts.alive.Store(false)\n\t\t\treturn\n\t\tdefault:\n\t\t}\n\n\t\treq, err := http.NewRequestWithContext(ctx, \"GET\", s.serveURL+\"/events\", nil)\n\t\tif err != nil {\n\t\t\tslog.Error(\"reasonix: create SSE request failed\", \"error\", err)\n\t\t\treturn\n\t\t}\n\n\t\tresp, err := s.sseClient.Do(req)\n\t\tif err != nil {\n\t\t\tif ctx.Err() != nil {\n\t\t\t\ts.alive.Store(false)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tslog.Warn(\"reasonix: SSE connect failed, retrying\", \"error\", err, \"backoff\", backoff)\n\t\t\ts.emit(core.Event{Type: core.EventError, Error: fmt.Errorf(\"SSE connect: %w (reconnecting)\", err)})\n\t\t\tgoto retryWait\n\t\t}\n\n\t\tif resp.StatusCode != http.StatusOK {\n\t\t\t_ = resp.Body.Close()\n\t\t\tslog.Warn(\"reasonix: SSE unexpected status, retrying\", \"status\", resp.StatusCode, \"backoff\", backoff)\n\t\t\tgoto retryWait\n\t\t}\n\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 {","sourceCodeStart":232,"sourceCodeEnd":268,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/agent/reasonix/session.go#L232-L268","documentation":"An EventError emitted by the reasonix SSE readLoop when the HTTP connection to GET /events fails while the context is still live: the message wraps the connect error and notes that a reconnect with backoff is underway. Transient by design; the loop retries automatically.","triggerScenarios":"Thrown at agent/reasonix/session.go:250 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Usually self-heals via automatic reconnection — observe only","If persistent, verify the reasonix serve instance is reachable","Check for proxies/firewalls blocking long-lived SSE connections"],"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"}