{"record":{"id":"41b02e98cdef1ea5","repo":"sipeed/picoclaw","slug":"turn-is-still-initializing-for-session-s","errorCode":null,"errorMessage":"turn is still initializing for session %s","messagePattern":"turn is still initializing for session (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/agent/steering.go","lineNumber":454,"sourceCode":"\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.\nfunc (al *AgentLoop) InterruptHard() error {\n\tts := al.getAnyActiveTurnState()\n\tif ts == nil {\n\t\treturn fmt.Errorf(\"no active turn\")\n\t}\n\tif strings.HasPrefix(ts.turnID, \"pending-\") {\n\t\treturn fmt.Errorf(\"turn is still initializing for session %s\", ts.sessionKey)\n\t}\n\tif !ts.requestHardAbort() {\n\t\treturn fmt.Errorf(\"turn %s is already aborting\", ts.turnID)\n\t}\n\n\tal.emitEvent(\n\t\truntimeevents.KindAgentInterruptReceived,\n\t\tts.eventMeta(\"InterruptHard\", \"turn.interrupt.received\"),\n\t\tInterruptReceivedPayload{\n\t\t\tKind: InterruptKindHard,\n\t\t},\n\t)\n\n\treturn nil\n}\n\n// ====================== SubTurn Result Polling ======================\n","sourceCodeStart":436,"sourceCodeEnd":472,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/pkg/agent/steering.go#L436-L472","documentation":"Initialization guard in the deprecated InterruptHard: getAnyActiveTurnState returned a turn, but its turnID still carries the 'pending-' prefix, meaning the turn was claimed but its real loop has not started — abort machinery (and a stable turn id) does not exist yet. The sessionKey in the message names the session whose turn is still spinning up.","triggerScenarios":"Thrown at pkg/agent/steering.go:454 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the abort after the turn finishes initializing","Use HardAbort(sessionKey), which handles pending turns correctly","Delay user-facing abort wiring until the turn reports as started"],"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"}