SessionStart hook shows 'startup hook error' despite successful execution

Resolved 💬 3 comments Opened Jan 29, 2026 by stanicio Closed Jan 29, 2026

Description

SessionStart hooks display 'SessionStart:startup hook error' in the CLI output even when the hook executes successfully (exit code 0, valid JSON output).

Steps to Reproduce

  1. Create a SessionStart hook in ~/.claude/settings.json:
{
  "hooks": {
    "SessionStart": [
      {
        "matcher": "",
        "hooks": [
          {
            "type": "command",
            "command": "node \"path/to/my-hook.mjs\""
          }
        ]
      }
    ]
  }
}
  1. The hook outputs valid JSON:
{"hookSpecificOutput":{"hookEventName":"SessionStart","additionalContext":"..."}}
  1. Start Claude Code CLI in any directory

Expected Behavior

  • Hook executes successfully
  • No error message shown (or shows "startup hook success")

Actual Behavior

  • Hook executes successfully (verified by log files)
  • CLI displays: SessionStart:startup hook error
  • Despite the error message, the hook output IS correctly injected into Claude's context

Environment

  • Claude Code v2.1.23
  • Windows 11
  • Node.js v22.x

Additional Context

  • This appears to be a UI bug where the status message shows "error" regardless of actual hook execution status
  • The hook functionality works correctly - only the status display is wrong
  • Issue occurs consistently across multiple sessions and restarts
  • Related to #12671 (if that issue exists)

Workaround

The hook output is correctly processed despite the error message, so functionality is not affected. The error message can be safely ignored.

View original on GitHub ↗

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