{"record":{"id":"35a0f8b9a766b5ef","repo":"sipeed/picoclaw","slug":"no-agent-available-for-session-q","errorCode":null,"errorMessage":"no agent available for session %q","messagePattern":"no agent available for session %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/agent/steering.go","lineNumber":406,"sourceCode":"\tif err := al.ensureHooksInitialized(ctx); err != nil {\n\t\tal.activeTurnStates.Delete(sessionKey)\n\t\treturn \"\", err\n\t}\n\tif err := al.ensureMCPInitialized(ctx); err != nil {\n\t\tal.activeTurnStates.Delete(sessionKey)\n\t\treturn \"\", err\n\t}\n\n\tsteeringMsgs := al.dequeueSteeringMessagesForScopeWithFallback(sessionKey)\n\tif len(steeringMsgs) == 0 {\n\t\tal.activeTurnStates.Delete(sessionKey)\n\t\treturn \"\", nil\n\t}\n\n\tagent := al.agentForSession(sessionKey)\n\tif agent == nil {\n\t\tal.activeTurnStates.Delete(sessionKey)\n\t\treturn \"\", fmt.Errorf(\"no agent available for session %q\", sessionKey)\n\t}\n\n\tif tool, ok := agent.Tools.Get(\"message\"); ok {\n\t\tif resetter, ok := tool.(interface{ ResetSentInRound(sessionKey string) }); ok {\n\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()","sourceCodeStart":388,"sourceCodeEnd":424,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/pkg/agent/steering.go#L388-L424","documentation":"Lookup guard in AgentLoop.Continue: steering messages were dequeued for the session and the turn-state claim is held, but agentForSession returned no AgentInstance for that sessionKey — the session has no registered agent (never started, or was cleaned up). The active-turn claim is deleted before returning so the session is not wedged.","triggerScenarios":"Thrown at pkg/agent/steering.go:406 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Start/initialize a session (send a first message) before issuing Continue","Ensure the session was not removed by cleanup while steering messages were pending","Register the agent instance for the session key before enqueueing steering messages"],"exampleFix":null,"handlingStrategy":"validation","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"}