Dylan Di Filippo
Dylan Di FilippoAI journal

Claude Code allows hooks to fail by blocking action

AnthropicCoding

Version 2.1.295 adds onFailure: "block" so an action does not go through if its control hook fails to start or fails during execution.

stable release

Official visual published by Anthropic for this announcement
Anthropic — visuel officiel · Image source ↗

A control hook can fail before it has checked anything: its command may not start, an HTTP request may time out, or execution may return an unexpected exit code. Claude Code 2.1.295 introduces onFailure: "block" for command and HTTP hooks, allowing those failures to stop the action instead of letting it proceed.

The distinction matters wherever a hook is intended to enforce a rule. A check that rejects an action and a check that never ran are different events, but both can now prevent execution when this option is configured. This is a failure-policy setting, not proof that every hook automatically blocks or that the checks themselves are sufficient.

The feature appears in the stable release of October 8 and requires Claude Code 2.1.295 or later. The release notes state no Belgium or EEA restriction. The behavior described here comes from those notes; it has not been independently exercised for this article.

← Back to this weekly edition

A journal by Dylan Di Filippo. Facts, vendor claims and editorial analysis are kept separate. Coverage is not exhaustive.