CLAUDE_PLUGIN_ROOT environment variable not set for SessionStart hooks

Resolved 💬 3 comments Opened Feb 20, 2026 by AKhozya Closed Feb 24, 2026

Description

Plugin hooks that reference ${CLAUDE_PLUGIN_ROOT} in their command work correctly for PreToolUse, PostToolUse, and other lifecycle events, but fail for SessionStart hooks because the environment variable is not populated at that stage.

Reproduction

  1. Install any plugin that uses ${CLAUDE_PLUGIN_ROOT} in a SessionStart hook command
  2. Start a new Claude Code session
  3. Observe: MODULE_NOT_FOUND error because the path resolves to "/scripts/hooks/..." (empty prefix)

Example from hooks.json:

{
  "event": "SessionStart",
  "hooks": [{
    "type": "command",
    "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/hooks/session-start.js\""
  }]
}

Expected Behavior

CLAUDE_PLUGIN_ROOT should be set for ALL hook lifecycle events, including SessionStart.

Actual Behavior

CLAUDE_PLUGIN_ROOT is unset during SessionStart, causing the command to fail with exit code 1 (MODULE_NOT_FOUND).

Workaround

Replace ${CLAUDE_PLUGIN_ROOT} with the absolute path to the plugin cache directory in hooks.json. Must be reapplied after plugin updates.

Environment

  • Claude Code (CLI)
  • macOS
  • Plugin: everything-claude-code v1.5.0

View original on GitHub ↗

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