`prompt`-type hooks crash on `SessionStart` with "ToolUseContext is required"

Resolved 💬 2 comments Opened May 11, 2026 by Tezigudo Closed May 13, 2026

Summary

Registering a "type": "prompt" hook under the SessionStart event causes the harness to emit:

Failed to run: ToolUseContext is required for prompt hooks. This is a bug.

The error message acknowledges itself as a bug. Either prompt hooks should work at SessionStart (the docs imply they should), or the harness should reject them with a clear validation error at hook-load time rather than at each session start.

Repro

Add to ~/.claude/settings.json:

{
  "hooks": {
    "SessionStart": [
      {
        "matcher": "startup |resume",
        "hooks": [{ "type": "prompt", "prompt": "hello" }]
      }
    ]
  }
}

Start any session. The error appears as the first system message.

Encountered via

The claude-obsidian marketplace plugin defines such a hook in its hooks/hooks.json. Filing the plugin-side issue separately, but the underlying harness behavior seems worth fixing/validating.

Environment

  • Claude Code, model claude-opus-4-7
  • darwin 25.3.0, zsh

View original on GitHub ↗

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