Claude Code 2.1.317 lets Agent SDK hooks block actions when callbacks fail
A new onFailure block option makes a failed Agent SDK hook callback stop the action instead of letting it run.
Claude Code 2.1.317 adds an onFailure setting, set to "block", that changes what happens when an Agent SDK hook callback fails. The action the callback guards is stopped rather than allowed to run.
The changelog says that with onFailure set to "block", a failed callback blocks the action instead of letting it run. It does not say what a failed callback does when the setting is absent.
The same release adds two notices, in Claude Desktop and in auto mode. Claude Desktop's Code tab gets a notice when an organization's remote managed settings haven't loaded for the session, and another when they do. A separate notice now appears when auto mode's check has no answer for a subagent's tool call. The changelog says that gap used to leave nothing in the main view.
The changelog entry for 2.1.317 also lists many items unrelated to hooks. These include a cost report in the gateway admin API, a warning in /schedule about connectors, and a check before a web or shell tool call sends a user's account email address to the network. The hook change is the only one that alters how a failing callback behaves. The rest of the release consists of other additions, changes, improvements and fixes.
What changed
Agent SDK hook callbacks set with onFailure set to "block" now stop the action they guard when they fail, instead of letting it run.
Type: New capability · Applies to: onFailure, Claude Code 2.1.317
Why it matters
Developers building controls on the Agent SDK can enforce fail-closed behaviour, so a broken guardrail cannot silently let an action through.
What you can do
Teams that rely on SDK hooks for policy enforcement could set failing callbacks to block where a silent pass would be unacceptable.
Original source
Where we saw it
Claude Code changelog
AI wrote this summary from the sources listed, and nobody reviewed it individually before publication. Check the original source before you rely on it. How it works