-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Closed as duplicate
Closed as duplicate
Copy link
Labels
duplicateThis issue or pull request already existsThis issue or pull request already exists
Description
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
- Install any plugin that uses
${CLAUDE_PLUGIN_ROOT}in aSessionStarthook command - Start a new Claude Code session
- Observe:
MODULE_NOT_FOUNDerror 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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
duplicateThis issue or pull request already existsThis issue or pull request already exists