sipeed/picoclaw · error
no active turn state found for session
Error message
no active turn state found for session %s
What it means
Lookup guard in AgentLoop.HardAbort(sessionKey): no entry for the given sessionKey exists in the active-turn map, so there is no running loop to cancel. Either the session's turn already finished/was aborted, or it never started — the session-scoped variant fails fast rather than guessing like the deprecated InterruptHard.
Solutions
- No-op if the turn is genuinely finished; treat 'nothing to abort' as success at the call site
- Verify the sessionKey matches the one used to start the turn
- If a turn should be running, check that it started and registered turn state
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at pkg/agent/steering.go:514 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of sipeed/picoclaw@49183d7e8d (2026-08-15).
Data as JSON: /api/errors/cb24ec80e15ead75.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/agent/steering.go:514
default:
return results
}
}
}
// ====================== Hard Abort ======================
// HardAbort immediately cancels the running agent loop for the given session,
// cascading the cancellation to all child SubTurns. This is a destructive operation
// that terminates execution without waiting for graceful cleanup.
//
// Use this when the user explicitly requests immediate termination (e.g., "stop now", "abort").
// For graceful interruption that allows the agent to finish the current tool and summarize,
// use Steer() instead.
func (al *AgentLoop) HardAbort(sessionKey string) error {
tsInterface, ok := al.activeTurnStates.Load(sessionKey)
if !ok {
return fmt.Errorf("no active turn state found for session %s", sessionKey)
}
ts, ok := tsInterface.(*turnState)
if !ok {
return fmt.Errorf("invalid turn state type for session %s", sessionKey)
}
if strings.HasPrefix(ts.turnID, "pending-") {
return fmt.Errorf("turn is still initializing for session %s", sessionKey)
}
logger.InfoCF("agent", "Hard abort triggered", map[string]any{
"session_key": sessionKey,
"turn_id": ts.turnID,
"depth": ts.depth,
"initial_history_length": ts.initialHistoryLength,
})
View on GitHub (pinned to 49183d7e8d)