Answer: To block the action when a callback fails, set `onFailure: "block"` in TypeScript or `on_failure="block"` in Python on the matcher. This requires TypeScript Agent SDK v0.3.317 or later, or Python Agent SDK v0.2.177 or later. Status: Confirmed Entry: tool/claude-code/permissions-and-security/block-on-hook-failure Revision: 1 Digest: sha256:a5ea093b3756d9f4 (changes whenever the content changes) Timeline: Created: 2026-11-13T03:02:44Z Last changed: 2026-11-13T03:02:44Z Last verified: 2026-11-20T12:16:39Z Next check: 2026-11-21T12:16:39Z Check interval: Daily Expected change: No fixed schedule Data: Field | Value | Source | As of TypeScript option | onFailure: "block" | [1] | 2026-11-20 Python option | on_failure="block" | [1] | 2026-11-20 TypeScript minimum version | v0.3.317 | [1] | 2026-11-20 Python minimum version | v0.2.177 | [1] | 2026-11-20 Tool result text | failed; blocking because onFailure is "block" | [1] | 2026-11-20 Sources: [1] Anthropic. "Intercept and control agent behavior with hooks". https://code.claude.com/docs/en/agent-sdk/hooks.md Role: primary. Accessed: 2026-11-20T12:16:39Z Quote: "set `onFailure: "block"` in TypeScript" (Supports: TypeScript option) Quote: "`on_failure="block"` in Python on the matcher" (Supports: Python option) Quote: "Requires TypeScript Agent SDK v0.3.317 or later" (Supports: TypeScript minimum version) Quote: "Python Agent SDK v0.2.177 or later" (Supports: Python minimum version) Quote: "The tool result includes `failed; blocking because onFailure is "block"`" (Supports: Tool result text) Published: 2026-11-20T03:48:55Z Snapshot SHA-256: 0b2c9a218508ae08aa03a1d9bfe5916d39a56028c80699d2264a63c27a851f84 (captured 2026-11-20T12:16:38Z) Verification: Method: Automated extraction from [1] with deepseek-flash (JSON output, thinking disabled). Every value was checked by code to appear verbatim in a quoted passage of [1]. Cross-check: not-available at 2026-11-20T12:16:39Z. No independent second source is configured for this entry Last successful check: 2026-11-20T12:16:39Z Last attempt: 2026-11-20T12:16:39Z Notes and limitations: Extracted automatically from a single official source (section "Block the action when a callback fails"). Related: https://latestn.com/tool/claude-code/permissions-and-security/block-protected-file-edits How do I block Claude Code from editing protected files with a hook? https://latestn.com/tool/claude-code/permissions-and-security/block-reads-generated-vendored-code How do I block reads of generated and vendored code in Claude Code? https://latestn.com/tool/claude-code/permissions-and-security/built-in-security-features What built-in security features does Claude Code have? https://latestn.com/tool/claude-code/permissions-and-security/available-permission-modes What permission modes are available in Claude Code? https://latestn.com/tool/claude-code/permissions-and-security/available-permission-modes-2 What permission modes are available in Claude Code and what does each auto-approve? https://latestn.com/tool/claude-code/permissions-and-security/aws-credentials-sigv4-api-key How do I authenticate Claude Code with AWS credentials using SigV4 or a workspace API key? https://latestn.com/tool/ All entries in AI tools Change log: Time | Event | Change | Source 2026-11-13T03:02:44Z | added | Entry created | — Changes for this entry as a feed: https://latestn.com/tool/claude-code/permissions-and-security/block-on-hook-failure/latest Challenge this entry: Open challenges: None How: If a value here is wrong or out of date, send what is wrong and a link to evidence. Challenges are queued and checked against the evidence; they do not change the entry by themselves. If the entry changes as a result, the change log says so. Form: https://latestn.com/dispute/tool/claude-code/permissions-and-security/block-on-hook-failure POST: https://latestn.com/dispute/tool/claude-code/permissions-and-security/block-on-hook-failure with claim, evidence_url, and optionally field and contact (form-encoded or JSON) GET: https://latestn.com/dispute/tool/claude-code/permissions-and-security/block-on-hook-failure?claim={what is wrong}&evidence_url={link} How to cite: LatestN. (2026). How do I block a tool call in Claude Code when a hook callback fails? Revision 1, last verified 2026-11-20T12:16:39Z. https://latestn.com/tool/claude-code/permissions-and-security/block-on-hook-failure (accessed 2026-11-21T09:58:53Z). @misc{LatestN_tool_claude_code_permissions_and_security_block_on_hook_failure_r1, title = {How do I block a tool call in Claude Code when a hook callback fails?}, author = {{LatestN}}, year = {2026}, howpublished = {\url{https://latestn.com/tool/claude-code/permissions-and-security/block-on-hook-failure}}, note = {Revision 1; digest sha256:a5ea093b3756d9f4; last verified 2026-11-20T12:16:39Z; accessed 2026-11-21T09:58:53Z} } Reuse: License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) Attribution: Copying and adapting are allowed, including commercially, if you credit LatestN and link to the entry you used. Each entry ends with a ready-made citation. URL: https://latestn.com/tool/claude-code/permissions-and-security/block-on-hook-failure