{"version":"2.1.295","anchor":"hooks-can-now-fail-closed-via-an-on-failure-setting","canonical_anchor":"hooks-can-now-fail-closed-via-an-on-failure-setting","heading":"Hooks can now block the action when they fail","tier":"use","area":"Hooks","scope":"both","heads_up":false,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.295\/e\/hooks-can-now-fail-closed-via-an-on-failure-setting","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.295","markdown":"### Hooks can now block the action when they fail\n\nA new hook option set to `block` makes a hook that fails, times out or returns bad output stop the action it guards\n\n**Unclear.** The name of the key to put in a hook's configuration for this setting is not known.\n\n**What**\n\nA hook is a command you configure Claude Code to run at set moments, often to check an action before it happens. A hook can now carry a new optional setting with two values:\n\n- `continue`, the default: the failure is reported and the action goes ahead\n\n- `block`: the failure counts as exit code 2, the hook's signal to block, so the action is stopped\n\nWith `block`, any of these counts as a failure:\n\n- the hook fails to start\n\n- the hook times out\n\n- the hook exits with a code other than 0 or 2\n\n- the hook prints JSON that is not valid\n\nThe setting is ignored for hooks that run in the background and for `Stop`, `SubagentStop`, `TaskCompleted` and `TeammateIdle` hooks.\n\n**Why**\n\nA hook that guards something sensitive can now fail safe, stopping the action instead of quietly letting it through when the hook itself breaks.\n\n- Area: Hooks\n- Tier: Use it now\n- Useful: 5\/5\n- Signal: 2\/5\n- Scope: both\n- Heads-up: no"}