{"version":"2.1.295","anchor":"hooks-get-an-onfailure-field-block-makes-a-failing-hook","canonical_anchor":"hooks-get-an-onfailure-field-block-makes-a-failing-hook","heading":"Hooks can be set to block when they fail","tier":"use","area":"Hooks","scope":"both","heads_up":false,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.295\/e\/hooks-get-an-onfailure-field-block-makes-a-failing-hook","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.295","markdown":"### Hooks can be set to block when they fail\n\nCommand and http hooks accept a new onFailure field, and setting it to \"block\" makes a failing hook block the action\n\n**What**\n\nHooks 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.\n\nThis 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\"`.\n\n**Why**\n\nBy 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.\n\n- Area: Hooks\n- Names: `onFailure`\n- Tier: Use it now\n- Useful: 5\/5\n- Signal: 2\/5\n- Scope: both\n- Heads-up: no"}