[BUG] Stop hook feedback with no output creates an infinite loop
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
even when the hook exits 0 with no stdout/stderr, the runner sends "No stderr output" back as a
conversational turn, which triggers another Stop event.
What Should Happen?
When a Stop hook exits 0 with no stdout/stderr, Claude Code should silently do nothing — no feedback message, no new turn. The stop
should proceed normally
Expected: Hook exits 0 with no output → no feedback message, no new turn, stop completes silently.
Actual: A "No stderr output" feedback message is synthesized and injected as a conversational turn, creating an infinite loop.
Error Messages/Logs
Steps to Reproduce
Reproduction steps:
- Add a Stop hook to ~/.claude/settings.json:
{
"hooks": {
"Stop": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "python3 -c \"import sys; sys.exit(0)\"",
"timeout": 5
}
]
}
]
}
}
- Start a new Claude Code session
- Send any message, e.g. say hello
- After Claude responds, observe the hook feedback appearing:
Stop hook feedback:
[python3 -c "import sys; sys.exit(0)"]: No stderr output
- This feedback is treated as a new user turn → triggers another response → triggers another Stop → infinite loop. Only way to break
out is Ctrl+C or Escape.
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.92
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Other
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗