8 pages for onfailure.
Titles and paths first, then pages whose text carries it. Each row opens that page as this site last read it.
Intercept and control agent behavior with hooks
Claude Code CLI · in the page
agent-sdk/hooks
…-timeout). Your SDK callbacks follow the `command` hook defaults | | `onFailure` | `"continue" \| "block"` | `undefined` | What a failed callback does. Set `"block"` to [block the action when a callba…
Agent SDK reference - TypeScript
Claude Code CLI · in the page
agent-sdk/typescript
…meout?: number; // Timeout in seconds for all hooks in this matcher onFailure?: "continue" | "block"; // "block" blocks the action when a callback fails } ``` To decide what `onFailure` covers, see…
Best practices for Claude Code
Claude Code CLI · in the page
best-practices
…ther. For real enforcement, use a `command` or `http` hook, and add [`onFailure: "block"`](https://code.claude.com/docs/en/hooks#block-the-action-when-a-hook-fails) if the action should also be stoppe…
Claude Code changelog
Claude Code CLI · in the page
changelog
…ll tool call sends your account email address to the network * Added `onFailure: "block"` for Agent SDK hook callbacks, so a callback that fails blocks the action instead of letting it run * Added a n…
Hooks reference
Claude Code CLI · in the page
hooks
…ince hooks spawn PowerShell directly. Ignored when `args` is set | | `onFailure` | no | Whether the action that triggered the hook goes ahead when the hook fails: `"continue"` or `"block"`. See [Block…
Automate actions with hooks
Claude Code CLI · in the page
hooks-guide
…om/docs/en/hooks.md#block-the-action-when-a-hook-fails). A hook with `onFailure` set to `"block"` is one example. Exit 0 to report no objection, or exit 2 to block the action: * **Exit 0**: if you ex…
Changelog
Claude Documentation · in the page
cowork/changelog
…command is only a quoted path or string, with no `shell`, `args` or `"onFailure": "continue"`, to block calls on PCs without Git for Windows. Install Git and reopen Claude, or for an `.exe` unquote it…
MCP, plugins, skills, and hooks
Claude Documentation · in the page
third-party/claude-desktop/extensions
…s/en/hooks#permissionrequest) command hook that has no `args` and no `onFailure` field blocks the tool call when it fails or times out, whatever `shell` it sets. A hook written for Bash that was given…