[BUG] SessionStart prompt hooks crash with unhandled exception

Resolved 💬 5 comments Opened Apr 15, 2026 by ep-eric Closed May 13, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Bug: SessionStart prompt hooks crash with unhandled exception

Summary

A SessionStart hook of type: "prompt" throws an unhandled exception on every session start. The exception message itself reads "This is a bug," suggesting the platform team may already be aware, or it's a generalized catch-all response. Reporting to confirm it is reproducible across platforms and versions, and to document the impact on plugin development.

---

Environment

  • Claude Code version: 2.1.109
  • Platforms: Ubuntu 24.04.4 LTS (x86_64), Raspberry Pi OS Lite 64-bit (aarch64) — reproduced on both

---

Steps to reproduce

  1. Create a hooks.json with a SessionStart prompt hook:
  {               
    "hooks": {
      "SessionStart": [
        {
          "hooks": [                                                                                        
            {
              "type": "prompt",                                                                             
              "prompt": "Your instruction here."
            }
          ]
        }
      ]
    }
  }
  1. Start a new Claude Code session.

---

Actual behavior

The session crashes immediately with:

ToolUseContext is required for prompt hooks. This is a bug.

---

Expected behavior

The prompt hook fires at session start and the model executes the instruction before the user's first message.

---

Additional notes

  • type: "command" hooks at SessionStart work — but only inject output as a <system-reminder>. The model does not act on it until the user sends their first message, making it unsuitable for auto-executing instructions on open.
  • ${CLAUDE_PLUGIN_ROOT} expands correctly in command hooks but not in prompt hooks.
  • The primary use case blocked by this bug: plugins that need to auto-run a startup routine (e.g. load session context, deliver a sitrep, custom greeting/instruction) when a session opens, without requiring the user to type a command first.

What Should Happen?

The prompt hook fires at session start and the model executes the instruction before the user's first message.

Error Messages/Logs

ToolUseContext is required for prompt hooks. This is a bug.

Steps to Reproduce

  1. Create a hooks.json with a SessionStart prompt hook:

```
{
"hooks": {
"SessionStart": [
{
"hooks": [
{
"type": "prompt",
"prompt": "Your instruction here."
}
]
}
]
}
}

   
  2. Start a new Claude Code session.

### Claude Model

Sonnet (default)

### Is this a regression?

I don't know

### Last Working Version

_No response_

### Claude Code Version

2.1.109

### Platform

Anthropic API

### Operating System

Ubuntu/Debian Linux

### Terminal/Shell

Terminal.app (macOS)

### Additional Information

_No response_

View original on GitHub ↗

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