SessionStart prompt hook fails: 'ToolUseContext is required for prompt hooks. This is a bug.'

Resolved 💬 3 comments Opened Apr 10, 2026 by ecoplazalabs Closed Apr 13, 2026

Bug Description

When starting a Claude Code session, a SessionStart hook of type "prompt" fails with the error:

SessionStart:startup hook error
Failed to run: ToolUseContext is required for prompt hooks. This is a bug.

The error message itself acknowledges this is a bug ("This is a bug").

Steps to Reproduce

  1. Configure a SessionStart hook with "type": "prompt" in settings.json
  2. Start a new Claude Code session
  3. The hook fails with the error above

Other SessionStart hooks (non-prompt type) in the same configuration execute successfully — only the prompt-type hook fails.

Expected Behavior

The SessionStart prompt hook should execute without errors, or at minimum, the ToolUseContext should be available/initialized before prompt hooks are invoked at session start.

Actual Behavior

The hook fails because ToolUseContext is not yet available when SessionStart prompt hooks are executed. The error is caught and displayed, but the session continues normally.

Environment

  • Claude Code version: 2.1.98
  • OS: Windows 11 Pro (10.0.26200)
  • Shell: bash
  • Node.js: (default system installation)

Related Issues

  • #45837 — Similar bug with agent-type hooks ("Messages are required for agent hooks") — closed as completed today
  • #26474 — Similar pattern with UserPromptSubmit agent hooks

Notes

This appears to be the same family of bugs where hook executors require context objects that aren't available at certain lifecycle points. The fix for #45837 may address this as well, but since the error message and hook type (prompt vs agent) differ, filing separately.

View original on GitHub ↗

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