sipeed/picoclaw · error
hook aborted turn during before_llm
Error message
hook aborted turn during before_llm: %s
What it means
Hook-policy error in askSideQuestion's before_llm phase: a hook attached to the pre-LLM stage returned HookActionAbortTurn, so the side question is not sent to the model at all. The %s is the hook's own Reason (defaulting to 'hook requested turn abort' when the hook gave none) — an intentional veto, not a transport failure.
Solutions
- Read the reason text to find which hook vetoed the call
- Tune the hook (rules, budget, model restrictions) so legitimate /btw questions pass
- Handle at the caller as a clean abort — do not retry blindly, the hook will veto again
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at pkg/agent/turn_coord.go:521 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/118cb2b8eb9be675.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/agent/turn_coord.go:521
GracefulTerminal: false,
})
switch decision.normalizedAction() {
case HookActionContinue, HookActionModify:
if llmReq != nil {
if strings.TrimSpace(llmReq.Model) != "" && llmReq.Model != llmModel {
hookModelChanged = true
}
llmModel = llmReq.Model
messages = llmReq.Messages
llmOpts = llmReq.Options
delete(llmOpts, "native_search")
}
case HookActionAbortTurn:
reason := decision.Reason
if reason == "" {
reason = "hook requested turn abort"
}
return "", fmt.Errorf("hook aborted turn during before_llm: %s", reason)
case HookActionHardAbort:
reason := decision.Reason
if reason == "" {
reason = "hook requested turn abort"
}
return "", fmt.Errorf("hook aborted turn during before_llm: %s", reason)
}
}
if hookModelChanged {
// Hook-selected models must not continue through the pre-hook fallback
// candidate list, otherwise fallback execution would call the original
// candidate model and silently ignore the hook decision.
activeCandidates = nil
}
callSideLLM := func(callMessages []providers.Message) (*providers.LLMResponse, error) {
if len(activeCandidates) > 1 && al.fallback != nil {
fbResult, err := al.fallback.ExecuteCandidate(View on GitHub (pinned to 49183d7e8d)