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

  1. Configure a PostToolUse hook in ~/.claude/settings.json:
"PostToolUse": [{
  "matcher": "",
  "hooks": [{
    "type": "command",
    "command": "cat /dev/stdin | python3 /path/to/hook.py",
    "timeout": 5
  }]
}]
  1. The hook writes a trace file on every invocation:
with open("/tmp/posttool_trace.log", "a") as f:
    f.write(f"{tool_name}\n")
  1. Run several Bash tool calls in a Claude Code session.
  1. Check /tmp/posttool_trace.logzero entries from Claude Code invocations, despite the hook working correctly when called manually via echo '{}' | python3 /path/to/hook.py.

Evidence

  • Trace file shows 0 entries from Claude Code runtime
  • Same trace file shows 2 entries from manual echo | python3 tests
  • 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.json has 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.

View original on GitHub ↗

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