SessionStart hooks crash when dispatcher routes through prompt-hook path expecting ToolUseContext

Resolved 💬 1 comment Opened Jun 1, 2026 by abouchard11 Closed Jul 3, 2026

Bug

SessionStart hooks error out because the hook dispatcher routes them through the prompt-hook code path, which expects a ToolUseContext that doesn't exist for SessionStart events.

Steps to reproduce

  1. Register a SessionStart hook in ~/.claude/settings.json:

``json
{
"hooks": {
"SessionStart": [
{
"type": "command",
"command": "echo '{\"systemMessage\": \"hello\"}'",
"timeout": 5000
}
]
}
}
``

  1. Start a new Claude Code session
  2. Observe the hook error in output

Expected behavior

SessionStart hooks should execute without errors. They don't involve tool use, so the dispatcher should not require ToolUseContext.

Actual behavior

The dispatcher routes SessionStart hooks through the prompt-hook path, which expects tool context. Since SessionStart hooks fire before any tools are invoked, there is no ToolUseContext available, causing an error.

Environment

  • Claude Code: 2.1.109
  • OS: macOS (Darwin arm64)

Notes

Despite the error, the hooks still appear to execute and their output reaches Claude's context (the systemMessage content is injected). The error seems to be a non-fatal code path issue in the dispatcher rather than a complete failure, but it generates noise on every session start.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗