Back to blog
Quality
Claude Code

What breaks when a Claude Code hook callback fails mid-run?

Thắng Đoàn
Thắng Đoàn

A failing Agent SDK hook callback would silently let the action proceed, and teams had no way to read past org spend per developer or IdP group. v2.1.317 adds onFailure blocking for hook callbacks plus a cost report admin API, alongside fixes for MCP disconnects and a token refresh race.

What it is

A Claude Code patch release centered on safety and observability. Hook callbacks can now block actions when they fail, tool calls ask before sending your account email to the network, and OTel telemetry gains plan, seat type, provider, and base URL attributes.

Applied case

You run an Agent SDK hook that must gate every action, but a callback exception previously let the tool call run anyway. Setting onFailure to "block" in v2.1.317 makes the failed callback block the action instead of letting it run, so a broken hook fails closed. The release notes describe exactly this behavior with no configuration details beyond the new onFailure value.

  • Set onFailure to "block" so a failing hook callback blocks the action instead of letting it run

When to use it

Use when failed hooks must fail closed, you need org cost analytics, or you hit the listed bugs like MCP servers dropping after the first turn.
Skip when none of these hooks, analytics, or fixed bugs apply to your setup.

Read more

Claude Code v2.1.317 release

Share:

Recommended for you

Enjoyed this article?

Subscribe for new articles. No spam. Unsubscribe anytime.

By subscribing you agree to receive the newsletter. No spam, and you can unsubscribe anytime.