What probably matters to youSection of the release
What
Hooks are your own commands or web requests that Claude Code runs at set moments, for example before a tool runs. Command hooks and http hooks now accept an onFailure field. Set it to "block" and a failure of that hook is treated as blocking, so the action it guards does not go ahead.
This does not apply to command hooks set to run in the background with async or asyncRewake. When a hook blocks this way, the reason given is blocking because onFailure is "block".
Why
By default a failing hook does not stop anything. A hook that enforces a rule can now fail closed, so a crash or error in the hook stops the action instead of letting it through unchecked.
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 sinceA 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/typescriptsee the edit
Confirmed sinceAnthropic's documentation has since written up onFailure, on Hooks reference.| `onFailure` | no | What happens to the action when the hook fails: `"continue"`, the default, or `"block"`. See [Block the action when a hook fails](#block-the-action-when-a-hook-fails). Requires Claude Code v2.1.295 or later |hookssee the edit
How sure we are
One source agreesOne thing we can check says the same as this entry.
Anthropic's documentation agreesAnthropic's documentation has since written up onFailure, on Hooks reference.