DNA News

Act on this, mostly signal

exit 1 does not block Claude Code hook commands

What to do

Use exit 2 in Claude Code hooks to block dangerous commands.

Why

Per the hooks docs, exit 1 is only a non-blocking error. Hook reliability for sub-agents and unattended runs is also questioned.

Read the source at note.com

What the research found

Per the Claude Code hooks docs as quoted, exit 1 is only a non-blocking error and does not stop a command, so blocking policies need exit 2; the article also questions whether hooks fire reliably for sub-agents, background and unattended runs, which it tested but the cached text does not show.

Claims and how well the evidence supports them

  1. In Claude Code hooks, exit 1 is treated as a non-blocking error and does not block the command 98%
  2. exit 2 is the exit code that blocks execution in Claude Code hooks 98%

Evidence

Actionability rated high.