SessionStart hook displays as 'error' despite successful execution (exit 0)
Resolved 💬 3 comments Opened Jan 19, 2026 by asphodelmoros Closed Jan 19, 2026
Description
SessionStart hooks that execute successfully (exit code 0) and output context to stdout display as "error" in the Claude Code startup UI, even though they function correctly.
Steps to Reproduce
- Configure a SessionStart hook in
~/.claude/settings.json:
{
"hooks": {
"SessionStart": [
{
"hooks": [
{
"type": "command",
"command": "/path/to/hook-script.sh"
}
]
}
]
}
}
- Create a simple hook script that outputs context and exits 0:
#!/bin/bash
echo "# Session Context"
echo "Some useful context here"
exit 0
- Start a new Claude Code session
Expected Behavior
The hook should display as successful (or not display an error state) since:
- The script exits with code 0
- The stdout content is correctly injected into Claude's context (verified - Claude receives the content)
Actual Behavior
The startup banner shows: SessionStart:startup hook error in red text, despite the hook functioning correctly.
Environment
- Claude Code version: v2.1.12
- Model: Opus 4.5
- OS: macOS (Darwin 24.2.0)
Notes
Per the hooks documentation, SessionStart hooks with exit code 0 should have their stdout "added directly as context" - this is working correctly. The issue is purely cosmetic/UI - the "error" label is misleading since the hook executed successfully and the context injection works.
🤖 Generated with Claude Code
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗