Closed
Description
Bug
The SessionStart hook in hooks/hooks.json fails on Linux with:
bash: line 1: /hooks/run-hook.cmd: No such file or directory
Root Cause
The hook command uses single quotes around ${CLAUDE_PLUGIN_ROOT}:
"command": "'${CLAUDE_PLUGIN_ROOT}/hooks/run-hook.cmd' session-start"Single quotes prevent shell variable expansion, so CLAUDE_PLUGIN_ROOT resolves to an empty string and the shell tries to execute /hooks/run-hook.cmd (absolute path from root), which doesn't exist.
Environment
- Claude Code v2.1.63
- Linux (Debian-based)
- Plugin version: 4.3.1
- Bash shell
Expected Behavior
The CLAUDE_PLUGIN_ROOT env variable should expand correctly so the hook finds run-hook.cmd in the plugin's hooks/ directory.
Suggested Fix
Use double quotes instead of single quotes in the command:
"command": "\"${CLAUDE_PLUGIN_ROOT}/hooks/run-hook.cmd\" session-start"Impact
Low — the plugin's skills, agents, and other hooks (PostToolUse, Stop, etc.) all work correctly. Only the SessionStart context injection fails silently.
Reacted by gregmackers and Jamie Clayton
Activity
fix: use double quotes for CLAUDE_PLUGIN_ROOT in SessionStart hook
obra commentedon Mar 10, 2026
Duplicate of #529 — same root cause (single quotes around ${CLAUDE_PLUGIN_ROOT} in hooks.json don't expand on Linux/Windows).
— Claude Opus 4.6, Claude Code 2.1.72
Merge PR #585: fix single quotes in SessionStart hook for Windows/Linux
Release v5.0.1: Windows/Linux hooks fix, Gemini CLI, spec review loop
fix: use double quotes for CLAUDE_PLUGIN_ROOT in SessionStart hook
Merge PR obra#585: fix single quotes in SessionStart hook for Windows…
Release v5.0.1: Windows/Linux hooks fix, Gemini CLI, spec review loop
fix: use double quotes for CLAUDE_PLUGIN_ROOT in SessionStart hook
Release v5.0.1: Windows/Linux hooks fix, Gemini CLI, spec review loop
fix: use double quotes for CLAUDE_PLUGIN_ROOT in SessionStart hook
Merge PR obra#585: fix single quotes in SessionStart hook for Windows…
Release v5.0.1: Windows/Linux hooks fix, Gemini CLI, spec review loop
feat: sync upstream v5.0.0-v5.1.0 (209 commits) while preserving fork