chiprook
← AI
AIOctober 19, 2026, 06:26

Claude Code hooks block tool calls only on exit code 2

A developer found that Claude Code hooks cancel a tool call only on exit code 2, while exit code 1 and any other non-zero code are treated as non-blocking errors. His guard hook using sys.exit(1) "blocked" 9 commands over three weeks, and all 9 ran anyway.

Claude Code hooks block tool calls only on exit code 2
#Anthropic#Claude
Read next
Software

Claude Code mods: plugins draw panels and intercept tool calls

Security

GitGuardian launches AI Hooks to block secrets in Claude Code, Cursor and Codex agents

AI

Claude Code 2.1.302 adds idle compaction and a 12-hook cap

Software

Claude Code 2.1.299–2.1.301 Changed Hook Behavior: 7 Things to Recheck