{"record":{"id":"118cb2b8eb9be675","repo":"sipeed/picoclaw","slug":"hook-aborted-turn-during-before-llm-s","errorCode":null,"errorMessage":"hook aborted turn during before_llm: %s","messagePattern":"hook aborted turn during before_llm: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/agent/turn_coord.go","lineNumber":521,"sourceCode":"\t\t\tGracefulTerminal: false,\n\t\t})\n\t\tswitch decision.normalizedAction() {\n\t\tcase HookActionContinue, HookActionModify:\n\t\t\tif llmReq != nil {\n\t\t\t\tif strings.TrimSpace(llmReq.Model) != \"\" && llmReq.Model != llmModel {\n\t\t\t\t\thookModelChanged = true\n\t\t\t\t}\n\t\t\t\tllmModel = llmReq.Model\n\t\t\t\tmessages = llmReq.Messages\n\t\t\t\tllmOpts = llmReq.Options\n\t\t\t\tdelete(llmOpts, \"native_search\")\n\t\t\t}\n\t\tcase HookActionAbortTurn:\n\t\t\treason := decision.Reason\n\t\t\tif reason == \"\" {\n\t\t\t\treason = \"hook requested turn abort\"\n\t\t\t}\n\t\t\treturn \"\", fmt.Errorf(\"hook aborted turn during before_llm: %s\", reason)\n\t\tcase HookActionHardAbort:\n\t\t\treason := decision.Reason\n\t\t\tif reason == \"\" {\n\t\t\t\treason = \"hook requested turn abort\"\n\t\t\t}\n\t\t\treturn \"\", fmt.Errorf(\"hook aborted turn during before_llm: %s\", reason)\n\t\t}\n\t}\n\tif hookModelChanged {\n\t\t// Hook-selected models must not continue through the pre-hook fallback\n\t\t// candidate list, otherwise fallback execution would call the original\n\t\t// candidate model and silently ignore the hook decision.\n\t\tactiveCandidates = nil\n\t}\n\n\tcallSideLLM := func(callMessages []providers.Message) (*providers.LLMResponse, error) {\n\t\tif len(activeCandidates) > 1 && al.fallback != nil {\n\t\t\tfbResult, err := al.fallback.ExecuteCandidate(","sourceCodeStart":503,"sourceCodeEnd":539,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/pkg/agent/turn_coord.go#L503-L539","documentation":"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.","triggerScenarios":"Thrown at pkg/agent/turn_coord.go:521 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"try-catch","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"}