{"record":{"id":"d26b3c4b9bdf5752","repo":"sipeed/picoclaw","slug":"turn-s-cannot-accept-graceful-interrupt","errorCode":null,"errorMessage":"turn %s cannot accept graceful interrupt","messagePattern":"turn (.+?) cannot accept graceful interrupt","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/agent/steering.go","lineNumber":429,"sourceCode":"\t\t\tresetter.ResetSentInRound(sessionKey)\n\t\t}\n\t}\n\n\tvar scope *session.SessionScope\n\tif metaStore, ok := agent.Sessions.(session.MetadataAwareSessionStore); ok {\n\t\tscope = metaStore.GetSessionScope(sessionKey)\n\t}\n\n\treturn al.continueWithSteeringMessages(ctx, agent, sessionKey, channel, chatID, scope, steeringMsgs)\n}\n\nfunc (al *AgentLoop) InterruptGraceful(hint string) error {\n\tts := al.getAnyActiveTurnState()\n\tif ts == nil {\n\t\treturn fmt.Errorf(\"no active turn\")\n\t}\n\tif !ts.requestGracefulInterrupt(hint) {\n\t\treturn fmt.Errorf(\"turn %s cannot accept graceful interrupt\", ts.turnID)\n\t}\n\n\tal.emitEvent(\n\t\truntimeevents.KindAgentInterruptReceived,\n\t\tts.eventMeta(\"InterruptGraceful\", \"turn.interrupt.received\"),\n\t\tInterruptReceivedPayload{\n\t\t\tKind:    InterruptKindGraceful,\n\t\t\tHintLen: len(hint),\n\t\t},\n\t)\n\n\treturn nil\n}\n\n// InterruptHard aborts an arbitrary active turn. In parallel mode this may\n// target the wrong session. Prefer HardAbort(sessionKey) instead.\n//\n// Deprecated: Use HardAbort(sessionKey) for session-safe aborts.","sourceCodeStart":411,"sourceCodeEnd":447,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/pkg/agent/steering.go#L411-L447","documentation":"Transition guard in AgentLoop.InterruptGraceful: an active turn exists, but its turn state rejected requestGracefulInterrupt — the turn is already terminal, already interrupting, or otherwise in a phase that cannot accept a new graceful-interrupt request. The turnID in the message identifies the stuck/rejecting turn; no event is emitted on this path.","triggerScenarios":"Thrown at pkg/agent/steering.go:429 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check turn state: if it is already finishing or interrupting, simply wait","Retry the interrupt shortly if the turn was mid-transition","Fall back to HardAbort(sessionKey) if graceful interrupt must succeed immediately","Ensure the interrupt isn't issued after the turn already completed"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"49183d7e8daed0dba89ddbb6fcb60089401d9680","analyzedAt":"2026-08-15T21:55:41.315Z","contentChangedAt":"2026-08-15T21:55:41.315Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}