[BUG] Hooks configured but not executing despite being detected

Resolved 💬 6 comments Opened Aug 4, 2025 by suyashb734 Closed Jan 4, 2026

Bug Description

Hooks configured in ~/.claude.json are detected by Claude Code but never execute, breaking hook-based workflows including auto-capture systems.

Environment

  • Claude Code Version: v1.0.67
  • Platform: macOS (Darwin 24.5.0)
  • Shell: Terminal

Steps to Reproduce

  1. Configure hooks in ~/.claude.json:
{
  "hooks": {
    "PreToolUse": [{
      "matcher": ".*",
      "hooks": [{
        "type": "command", 
        "command": "python3 /tmp/hook_detector.py",
        "timeout": 30
      }]
    }]
  }
}
  1. Create a hook detection script at /tmp/hook_detector.py:
#\!/usr/bin/env python3
import sys
from datetime import datetime

log_file = "/tmp/claude_hook_execution.log"
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")

try:
    hook_data = sys.stdin.read()
    with open(log_file, "a") as f:
        f.write(f"\n🎯 HOOK EXECUTED: {timestamp}\n")
        f.write(f"Input length: {len(hook_data)} bytes\n")
except Exception as e:
    with open(log_file, "a") as f:
        f.write(f"ERROR: {timestamp} - {str(e)}\n")
  1. Execute any tool operations (Read, Write, Edit, etc.)
  2. Check for hook execution traces

Expected Behavior

Hooks should execute before/after tool operations as configured, creating log entries.

Actual Behavior

  • Debug output shows: "Found 1 hook matchers in settings" (hooks are detected)
  • No hook execution occurs (no log files created)
  • Hook script works perfectly when run independently: echo "test" | python3 /tmp/hook_detector.py

Evidence

# Hook script works independently
$ echo "test hook input" | python3 /tmp/hook_detector.py
$ cat /tmp/claude_hook_execution.log
🎯 HOOK EXECUTED: 2025-08-04 16:04:33
Input length: 16 bytes

# But no execution during Claude Code tool operations despite configuration
$ ls -la /tmp/claude_hook_execution.log
ls: /tmp/claude_hook_execution.log: No such file or directory

Impact

  • Auto-capture knowledge systems non-functional
  • Hook-based development workflows broken
  • Configuration appears correct but system doesn't work

Additional Context

This affects productivity workflows that depend on hooks for automation. The hooks system appears to be a configuration detection issue rather than a script problem, as independent execution works perfectly.

View original on GitHub ↗

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