{"record":{"id":"837715410ca3ce0e","repo":"chenhg5/cc-connect","slug":"session-is-closed-837715","errorCode":null,"errorMessage":"session is closed","messagePattern":"session is closed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agent/cursor/session.go","lineNumber":105,"sourceCode":"\t\t\t\t// Feishu image messages carry no filename — synthesise one so\n\t\t\t\t// the file lands with a correct extension.\n\t\t\t\tname = fmt.Sprintf(\"img_%d_%d%s\", time.Now().UnixMilli(), i, core.ExtFromMime(im.MimeType))\n\t\t\t}\n\t\t\timgFiles = append(imgFiles, core.FileAttachment{\n\t\t\t\tMimeType: im.MimeType,\n\t\t\t\tData:     im.Data,\n\t\t\t\tFileName: name,\n\t\t\t})\n\t\t}\n\t\timagePaths := core.SaveFilesToDisk(cs.workDir, messageID, imgFiles)\n\t\tprompt = core.AppendImageRefs(prompt, imagePaths)\n\t}\n\tif len(files) > 0 {\n\t\tfilePaths := core.SaveFilesToDisk(cs.workDir, messageID, files)\n\t\tprompt = core.AppendFileRefs(prompt, filePaths)\n\t}\n\tif !cs.alive.Load() {\n\t\treturn fmt.Errorf(\"session is closed\")\n\t}\n\n\tchatID := cs.CurrentSessionID()\n\tisResume := chatID != \"\"\n\n\targs := append(append([]string{}, cs.extraArgs...),\n\t\t\"--print\",\n\t\t\"--output-format\", \"stream-json\",\n\t)\n\n\tswitch cs.mode {\n\tcase \"force\":\n\t\targs = append(args, \"--force\")\n\tcase \"plan\":\n\t\targs = append(args, \"--mode\", \"plan\")\n\tcase \"ask\":\n\t\targs = append(args, \"--mode\", \"ask\")\n\t}","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/agent/cursor/session.go#L87-L123","documentation":"A sentinel liveness guard on cursorSession.Send: the session is no longer alive (Close() ran or the context cancelled), so launching another Cursor turn is rejected before any staging or spawning happens.","triggerScenarios":"Thrown at agent/cursor/session.go:105 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Start a new session rather than reusing the closed one","Avoid sending after teardown (/stop or errors)","Inspect logs for the closure cause if unexpected"],"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-14T11:17:12.474Z"}