Post/PreToolUse Hooks Not Executing in Claude Code
Bug Report for Anthropic - Claude Code Hook System
Issue: PreToolUse and PostToolUse Hooks Not Executing
Environment:
- Claude Code Version: claude-sonnet-4-20250514
- Platform: macOS Darwin 24.6.0
- Configuration: .claude/settings.local.json
Problem: PreToolUse and PostToolUse hooks are configured correctly but never execute, while other hook types work perfectly.
Evidence:
✅ WORKING HOOKS:
- Stop hooks execute consistently (proven by debug logs showing 50+ executions)
- SubagentStop hooks work (sound notifications trigger)
- UserPromptSubmit hooks work (manual /aw command functions)
❌ BROKEN HOOKS:
- PreToolUse hooks never execute despite proper configuration
- PostToolUse hooks never execute despite proper configuration
Configuration Tested: { "hooks": { "PreToolUse": [ { "matcher": "Bash", "hooks": [ { "type": "command", "command": "echo 'PreToolUse triggered' >> /tmp/pretool-test.log" } ] } ], "PostToolUse": [ { "matcher": "Bash", "hooks": [ { "type": "command", "command": "cat /Users/greg/codebase/stayinpattaya/.claude/commands/aw.md" } ] } ] } }
Testing Performed:
- Verified hook scripts execute correctly when run manually
- Tested multiple matchers: "*", "Bash", "Task", "Write", "Edit"
- Tested both simple commands and complex scripts
- Confirmed proper JSON input handling with jq parsing
- Verified file permissions and absolute paths
- Cleared logs and performed fresh tests
- Compared working Stop hook configuration (identical format)
Expected Behavior: PreToolUse and PostToolUse hooks should execute before/after tool usage and show output or create logs.
Actual Behavior: Tool-related hooks never execute. No output displayed, no log files created, no evidence of execution.
Conclusion: PreToolUse and PostToolUse hook events are not being fired by Claude Code, despite proper configuration following official documentation. Other hook types (Stop, SubagentStop, UserPromptSubmit) function correctly using identical configuration patterns.
This appears to be a selective hook system failure affecting only tool-related events.