SessionStart hook shows 'hook error' despite successful execution (exit 0)

Resolved 💬 3 comments Opened Nov 29, 2025 by vtjballeng Closed Dec 2, 2025

Description

SessionStart hooks always display 'SessionStart:startup hook error' in the CLI UI, even when:

  • The hook script exits with code 0
  • The hook produces valid output
  • The debug log shows the hook matched and ran successfully

Environment

  • Claude Code version: v2.0.55
  • OS: Windows 11 with Git Bash
  • Shell: Git Bash (C:\Program Files\Git\bin\bash.exe)

Steps to Reproduce

  1. Create a SessionStart hook in .claude/settings.local.json:
"SessionStart": [
  {
    "matcher": "startup",
    "hooks": [
      {
        "type": "command",
        "command": "bash ./.claude/read-claude-md.sh"
      }
    ]
  }
]
  1. Create the script .claude/read-claude-md.sh:
#!/bin/bash
if [ -f "CLAUDE.md" ]; then
    echo "I have read CLAUDE.md"
    exit 0
else
    echo "WARNING: CLAUDE.md not found"
    exit 1
fi
  1. Start Claude Code with claude --debug

Expected Behavior

Hook runs successfully (exit 0), no error message displayed

Actual Behavior

  • Debug log shows: Hook output does not start with {, treating as plain text
  • UI always shows: SessionStart:startup hook error
  • Hook actually executes successfully (confirmed via debug log)

Debug Log Evidence

Getting matching hook commands for SessionStart with query: startup
Found 1 hook matchers in settings
Matched 1 unique hooks for query "startup" (1 before deduplication)
...
Hook output does not start with {, treating as plain text

Workaround Attempts

  • JSON output format with {"additionalContext": "..."} - still shows error
  • Silent execution (no output, just exit 0) - still shows error
  • Various matcher configurations - still shows error

Related Issues

Possibly related to #10463

View original on GitHub ↗

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