{"record":{"id":"138d7dc694b279e4","repo":"chenhg5/cc-connect","slug":"acp-no-active-session-to-cancel","errorCode":null,"errorMessage":"acp: no active session to cancel","messagePattern":"acp: no active session to cancel","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agent/acp/session.go","lineNumber":712,"sourceCode":"\treturn s.tr.respondSuccess(st.RPCID, res)\n}\n\nfunc (s *acpSession) Events() <-chan core.Event {\n\treturn s.events\n}\n\nfunc (s *acpSession) CurrentSessionID() string {\n\treturn s.currentACPSessionID()\n}\n\n// CancelTurn sends an ACP session/cancel notification to abort the current\n// turn while keeping the session alive. The agent should cancel the active\n// LLM request and persist state, then wait for the next user message on the\n// same connection. This is used by /stop instead of Close().\nfunc (s *acpSession) CancelTurn() error {\n\tsid := s.currentACPSessionID()\n\tif sid == \"\" {\n\t\treturn fmt.Errorf(\"acp: no active session to cancel\")\n\t}\n\tif s.tr == nil {\n\t\treturn fmt.Errorf(\"acp: transport not available\")\n\t}\n\tslog.Debug(\"acp: cancelling current turn\", \"session_id\", sid)\n\treturn s.tr.sendNotification(\"session/cancel\", map[string]any{\n\t\t\"sessionId\": sid,\n\t})\n}\n\nfunc (s *acpSession) Alive() bool {\n\treturn s.alive.Load()\n}\n\nfunc (s *acpSession) Close() error {\n\ts.alive.Store(false)\n\ts.cancel()\n\tif s.cmd != nil && s.cmd.Process != nil {","sourceCodeStart":694,"sourceCodeEnd":730,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/agent/acp/session.go#L694-L730","documentation":"A sentinel guard in acpSession.CancelTurn (backing /stop): the session has no stored ACP session ID, so there is nothing to send a session/cancel notification to. It fires when /stop is issued before any turn has established an agent-side session.","triggerScenarios":"Thrown at agent/acp/session.go:712 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["No action needed if no turn was actually running","Send a message first to establish the ACP session, then use /stop","Ignore the error in UI flows where /stop is a no-op"],"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-14T05:17:10.506Z"}