Claude Code enters infinite loop when hooks are enabled
Resolved 💬 3 comments Opened Oct 23, 2025 by ianbuitrago-taulia Closed Oct 27, 2025
Environment
- OS: macOS Tahoe
- Hook execution time: ~60ms (just touching a signal file)
Hook Configuration
"hooks": {
"Notification": [{
"matcher": "",
"hooks": [{"type": "command", "command": "python3 ~/.claude/hooks/notification.py --notify"}]
}],
"Stop": [{
"matcher": "",
"hooks": [{"type": "command", "command": "python3 ~/.claude/hooks/stop.py --notify"}]
}]
}
Hook Implementation
The hooks are extremely minimal - they just:
- Read stdin (required by hook protocol)
- Touch a signal file (~/.claude/tts_signals/notify or stop)
- Exit immediately
No subprocess spawning, no blocking operations, execution time ~60ms.
Observed Behavior
When hooks are enabled, Claude Code enters an infinite loop during normal operation. When hooks are disabled, no issues occur.
Expected Behavior
Hooks should not cause Claude Code to loop, especially when they execute quickly and do not spawn subprocesses.
Reproduction
Configure fast hooks that touch signal files and observe Claude Code behavior during normal operation.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗