Unclear Whether onFailure is something you can set on your own hooks is not known.
What
Hooks are commands you configure to run automatically at certain points, for example before a tool runs.
- Hook commands accept a new
on_failurefield, set tocontinueorblock. It can be left out, and an invalid value falls back toblock. What reads this field at runtime was not traced, so its effect is not confirmed. - The signature Claude Code uses to compare cloud hooks now includes
onFailure, unless it isblock. Before, it only left outcloud. - When a headless cloud session (one running on Anthropic's servers without the interactive screen) is launched, its launch report now includes
builtin_tools_count, the number of built-in tools passed in.
Why
The new field suggests hook authors may be able to choose whether a failing hook stops the action or lets it continue. Until it is confirmed to have an effect, treat block as the behaviour you get.
Names in the bundleonFailure
The entry above is what we published on the day. These lines were added later, as Anthropic's own pages caught up, and they sit beside the original rather than replacing it.
Added since
A small documentation edit on Agent SDK reference - TypeScript touched a line naming onFailure after this was published.
onFailure?: "continue" | "block"; // "block" blocks the action when a callback failsagent-sdk/typescript see the edit
Confirmed since
Anthropic's documentation has since written up onFailure, on MCP, plugins, skills, and hooks.
A [`PreToolUse`](https://code.claude.com/docs/en/hooks#pretooluse) hook that runs this way and has no `onFailure` field blocks the tool call when it fails or times out. The hook error that Claude receives includes `blocking because Git Bas…third-party/claude-desktop/extensions see the edit
Something disagreesSomething we can check disagrees with this entry, or the writer said they could not settle it.
The writer flagged doubt
Whether `onFailure` is something you can set on your own hooks is not known.
Anthropic's documentation agrees
Anthropic's documentation has since written up onFailure, on MCP, plugins, skills, and hooks.