PostToolUse hooks not invoked for Bash tool calls
Resolved 💬 3 comments Opened Mar 19, 2026 by ninjra Closed Mar 23, 2026
Description
PostToolUse hooks configured in settings.json are not reliably invoked for Bash tool calls. The hook process is never spawned by Claude Code, despite the configuration being correct and the hook working when invoked manually.
Reproduction
- Configure a PostToolUse hook in
~/.claude/settings.json:
"PostToolUse": [{
"matcher": "",
"hooks": [{
"type": "command",
"command": "cat /dev/stdin | python3 /path/to/hook.py",
"timeout": 5
}]
}]
- The hook writes a trace file on every invocation:
with open("/tmp/posttool_trace.log", "a") as f:
f.write(f"{tool_name}\n")
- Run several Bash tool calls in a Claude Code session.
- Check
/tmp/posttool_trace.log— zero entries from Claude Code invocations, despite the hook working correctly when called manually viaecho '{}' | python3 /path/to/hook.py.
Evidence
- Trace file shows 0 entries from Claude Code runtime
- Same trace file shows 2 entries from manual
echo | python3tests - Hook metrics in the queue file show posttool execution times of 0.018ms (suspiciously fast — suggests the hook body isn't actually executing)
- PreToolUse and Stop hooks on the same session work correctly
Environment
- Claude Code CLI (latest)
- Linux (WSL2), Python 3.12
settings.jsonhas PostToolUse configured with"matcher": ""
Impact
PostToolUse hooks are critical for governance — we use them to stamp tool outputs for downstream compliance checks. Without reliable invocation, output validation cannot function.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗