{"record":{"id":"70a303cc1cd5eff4","repo":"chenhg5/cc-connect","slug":"reasonix-new-session-w","errorCode":null,"errorMessage":"reasonix: new session: %w","messagePattern":"reasonix: new session: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agent/reasonix/session.go","lineNumber":133,"sourceCode":"\t\tcancel:        cancel,\n\t\tevents:        make(chan core.Event, 128),\n\t\tturnDone:      make(chan struct{}, 1),\n\t\treadLoopDone:  make(chan struct{}),\n\t\tmaxReconnects: 5,\n\t\tsseClient: &http.Client{\n\t\t\tTimeout: 0, // no timeout for SSE\n\t\t\tTransport: &http.Transport{\n\t\t\t\tResponseHeaderTimeout: 30 * time.Second,\n\t\t\t},\n\t\t},\n\t}\n\ts.alive.Store(true)\n\n\t// Start fresh session on reasonix if sessionID is empty or 'new'\n\tif sessionID == \"\" || sessionID == \"new\" {\n\t\tif err := s.httpPost(\"/new\", nil); err != nil {\n\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}","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/agent/reasonix/session.go#L115-L151","documentation":"Wraps a failed POST /new inside reasonix newSession (invoked when no session ID or the literal 'new' is passed): the remote serve instance refused or failed the request to create a fresh session. The session context is cancelled and StartSession surfaces the error.","triggerScenarios":"Thrown at agent/reasonix/session.go:133 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the reasonix serve process is up and responsive","Check serve_url correctness and network connectivity","Read the wrapped error for HTTP status/connection details"],"exampleFix":null,"handlingStrategy":"try-catch","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"}