{"record":{"id":"1f740856d1d1dea7","repo":"chenhg5/cc-connect","slug":"reasonix-session-is-closed","errorCode":null,"errorMessage":"reasonix: session is closed","messagePattern":"reasonix: session is closed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agent/reasonix/session.go","lineNumber":150,"sourceCode":"\t\t\tcancel()\n\t\t\treturn nil, fmt.Errorf(\"reasonix: new session: %w\", err)\n\t\t}\n\t\tslog.Info(\"reasonix: created new session\")\n\t}\n\n\t// Start SSE reader in background\n\treaderCtx, readerCancel := context.WithCancel(ctx)\n\ts.sseCancel = readerCancel\n\tgo s.readLoop(readerCtx)\n\n\treturn s, nil\n}\n\n// ── core.AgentSession implementation ─────────────────────────────\n\nfunc (s *reasonixSession) Send(prompt string, messageID string, images []core.ImageAttachment, files []core.FileAttachment) error {\n\tif !s.alive.Load() {\n\t\treturn fmt.Errorf(\"reasonix: session is closed\")\n\t}\n\n\t// Save images/files to disk and append references\n\tif len(images) > 0 {\n\t\tprompt = prompt + \"\\n\\n[Attached images: \" + formatImages(images) + \"]\"\n\t}\n\tif len(files) > 0 {\n\t\tfilePaths := core.SaveFilesToDisk(s.workDir, messageID, files)\n\t\tprompt = core.AppendFileRefs(prompt, filePaths)\n\t}\n\n\t// Handle special commands locally\n\tif strings.TrimSpace(prompt) == \"/compact\" {\n\t\treturn s.httpPost(\"/compact\", nil)\n\t}\n\n\t// Submit to reasonix\n\ts.inTurn.Store(true)","sourceCodeStart":132,"sourceCodeEnd":168,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/agent/reasonix/session.go#L132-L168","documentation":"A sentinel liveness guard at the top of reasonixSession.Send: the session's alive flag is false (Close() ran, or the SSE reader marked the session dead after terminal disconnect). Any prompt submission is rejected before touching the HTTP endpoint.","triggerScenarios":"Thrown at agent/reasonix/session.go:150 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Start a new session — this one is closed","Check earlier events for why the SSE connection died","Avoid sending after explicit close or fatal disconnects"],"exampleFix":null,"handlingStrategy":"validation","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-14T00:17:10.932Z"}