[BUG] PostToolUse hook JSON output not processed by Claude Code

Resolved 💬 12 comments Opened Jul 19, 2025 by durapensa Closed Jan 6, 2026

Environment

  • Platform (select one):
  • [x] Anthropic API
  • [ ] AWS Bedrock
  • [ ] Google Vertex AI
  • [ ] Other:
  • Claude CLI version: 1.0.56 (Claude Code)
  • Operating System: macOS 15.5 (Darwin 24.5.0)
  • Terminal: Ghostty.app

Bug Description

PostToolUse hooks that output JSON in the documented format are not being processed by Claude Code. The hook correctly outputs JSON with exit code 0, but Claude Code does not make this data available to the AI assistant as documented.

Steps to Reproduce

  1. Create a PostToolUse hook that outputs JSON in the documented format:

``json
{"reason": "Hook feedback message"}
``

  1. Configure the hook in .claude/settings.local.json:

``json
{
"hooks": {
"postToolUse": {
"Bash": "python3 /path/to/hook_script.py"
}
}
}
``

  1. Execute a Bash command that triggers the hook (e.g., ls)
  2. Hook executes successfully with exit code 0 and outputs the JSON
  3. Claude Code does not receive/process the JSON output

Expected Behavior

According to the hooks documentation, when a PostToolUse hook returns exit code 0 with JSON output, Claude Code should process that JSON. The AI assistant should have access to the hook's output data.

Actual Behavior

  • Hook executes correctly (verified via diagnostic logging)
  • Hook outputs proper JSON format (verified by capturing stdout)
  • Hook exits with code 0 (success)
  • Claude Code does not process the JSON output
  • The AI assistant never receives the hook data

Additional Context

This issue has been present since at least version 1.0.44. The hook implementation follows the documented specification exactly:

# Hook outputs JSON and exits with code 0
output = {"reason": "[KSI ⚡3]"}
print(json.dumps(output), flush=True)
sys.exit(0)

Diagnostic logs confirm the hook is working:

2025-07-19T10:30:59.565767 - JSON feedback output: [KSI ⚡3]

But Claude Code is not processing this output as documented. This prevents hooks from providing feedback to the AI assistant during tool execution.

Related Issues:

  • #2814 documents other hook system issues
  • Hook output visibility is only one part of the broader hooks implementation problems

Workaround:
Currently forced to write diagnostic data to external log files since the documented JSON communication method doesn't work.

View original on GitHub ↗

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