Plugin hooks fail: CLAUDE_PLUGIN_ROOT not injected at hook execution time
Description
Plugin hooks that use ${CLAUDE_PLUGIN_ROOT} in their command strings fail because the environment variable is not set when the hook command executes. The variable resolves to empty, causing paths like "${CLAUDE_PLUGIN_ROOT}/hooks/session-start-seen-skills.mjs" to become "/hooks/session-start-seen-skills.mjs" — which doesn't exist.
Affected hooks
All three hook event types show errors:
SessionStart:startup hook errorUserPromptSubmit hook errorPostToolUse:Bash hook error
Affected plugins
Every plugin that defines hooks using ${CLAUDE_PLUGIN_ROOT} is affected:
vercel@claude-plugins-official(SessionStart, UserPromptSubmit, PostToolUse:Bash)superpowers@claude-plugins-official(SessionStart)explanatory-output-style@claude-plugins-official(SessionStart)vercel-plugin@vercel-vercel-plugin(SessionStart, UserPromptSubmit, PostToolUse:Bash)
Reproduction
- Enable any of the above plugins
- Start a new session
- Observe
SessionStart:startup hook errorimmediately - Send a message →
UserPromptSubmit hook error - Run any Bash command →
PostToolUse:Bash hook error
Manual verification
Running a plugin hook manually with CLAUDE_PLUGIN_ROOT set works fine:
CLAUDE_PLUGIN_ROOT="/path/to/plugin/root" node "$CLAUDE_PLUGIN_ROOT/hooks/session-start-seen-skills.mjs"
Without it:
Error: Cannot find module '/hooks/session-start-seen-skills.mjs'
Environment
- Claude Code version: 2.1.92 (latest)
- macOS Darwin 25.4.0
- Node.js v22.22.1
- Plugin cache location:
~/Library/Mobile Documents/com~apple~CloudDocs/claude-config/plugins/cache/
Impact
Cosmetic — plugin skills and tools still work. Only the hook-based features (telemetry, skill injection, session profiling) are broken. The errors appear on every session start, every prompt submit, and every Bash tool use, which is noisy.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗