[BUG] Stop hook causes empty result in print mode (-p)
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?
When any Stop hook is configured in ~/.claude/settings.json, running claude -p produces no output. The model generates text correctly (confirmed via --output-format stream-json --verbose), but the final result field is always an empty string "", so nothing is printed to stdout.
The hook command itself doesn't matter — even a no-op (true) reproduces the issue. Other hook types (Notification, PreToolUse, PermissionRequest) do not cause this.
What Should Happen?
claude -p 'hello' should print the model's response to stdout regardless of whether a Stop hook is configured.
Version
2.1.83
Platform
macOS (Darwin 25.3.0, ARM64)
Steps to Reproduce
- Add a Stop hook to
~/.claude/settings.json:
{
"hooks": {
"Stop": [
{
"hooks": [
{ "type": "command", "command": "true" }
]
}
]
}
}
- Run:
claude -p 'say hi'
# → no output
- Confirm model generates text but result is empty:
claude -p 'say hi' --output-format stream-json --verbose 2>&1 | grep '"text"'
# → "text":"Hi! How can I help you today?"
claude -p 'say hi' --output-format json
# → "result": ""
- Confirm it works without user settings:
claude -p 'say hi' --setting-sources ''
# → Hi! How can I help you today?
- Confirm other hooks don't cause the issue:
claude -p 'say hi' --setting-sources '' --settings '{"hooks":{"Notification":[{"hooks":[{"type":"command","command":"true"}]}]}}'
# → Hi! How can I help you today? ✅
claude -p 'say hi' --setting-sources '' --settings '{"hooks":{"Stop":[{"hooks":[{"type":"command","command":"true"}]}]}}'
# → (empty) ❌
Workaround
Skip user settings when running in print mode:
claude -p 'hello' --setting-sources 'project,local'
Error Messages/Logs
No errors. The command exits 0 with empty stdout.
This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗