[BUG] PostToolUse Hook Exit Code 1 Blocks Claude Execution

Resolved 💬 5 comments Opened Jul 30, 2025 by dwenaus Closed Aug 15, 2025

Environment

  • Platform: Anthropic API (via claude code max20)
  • Claude CLI version: 1.0.64
  • Operating System: macOS
  • Terminal: Terminal App

Bug Description

PostToolUse hooks with exit code 1 block Claude's execution despite documentation stating they are "non-blocking" and "execution continues".

Steps to Reproduce

  1. Create .claude/settings.json:

{
"hooks": {
"PostToolUse": [{
"matcher": "Read",
"hooks": [{
"type": "command",
"command": "./test-hook.sh"
}]
}]
}
}

  1. Create test-hook.sh:

#!/bin/bash
echo "Warning: This is a non-blocking error" >&2
exit 1

  1. Make it executable: chmod +x test-hook.sh
  2. Ask Claude: "Read any file, then list the current directory"
  3. Observe Claude is blocked after the Read operation

Expected Behavior

According to documentation: "Other exit codes: Non-blocking error. stderr is shown to the user and execution continues." https://docs.anthropic.com/en/docs/claude-code/hooks

Claude should:

  1. Execute Read tool
  2. Show hook's stderr to user
  3. Continue with ls command

Actual Behavior

  1. Read tool executes
  2. User sees: PostToolUse:Read [./test-hook.sh] failed with non-blocking status code 1: Warning: This is a non-blocking error
  3. Claude is blocked - cannot execute ls or any other command
  4. User must type a response before Claude can continue

Additional Context

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗