How to Make a Claude Code Hook Fail Closed with onFailure: "block"
Since Claude Code v2.1.295, a command or HTTP hook can set onFailure to "block" so a guard that crashes, times out, cannot start or prints invalid JSON stops the tool call instead of waving it through. Here is the config, what counts as a failure, the events where it does nothing, and the exit-0 trap no setting can catch.