[BUG] Plugin hooks.json: ${CLAUDE_PLUGIN_ROOT} not expanded on Windows
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Environment: Windows 11, Claude Code (latest)
I am testing creating of plugins locally.
Problem:
When a local plugin's hooks.json references ${CLAUDE_PLUGIN_ROOT} for the
command path, the variable is not expanded on Windows. This causes a hook
error on every Bash tool call (PreToolUse:Bash).
hooks.json example:
"command": "${CLAUDE_PLUGIN_ROOT}/hooks/my_hook.py"
Expected: Path resolves to the plugin's installation directory
Actual: Literal string ${CLAUDE_PLUGIN_ROOT} is passed → file not found → hook error
Workaround: Deregister local plugins; copy hooks directly to ~/.claude/hooks/
What Should Happen?
Expected: Path resolves to the plugin's installation directory
Actual: Literal string ${CLAUDE_PLUGIN_ROOT} is passed → file not found → hook error
Error Messages/Logs
PreToolUse:Bash Hook error
Steps to Reproduce
Create a local plugin and try to register.
Then execute that plugin.
Claude Model
Opus
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
2.1.71
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
PowerShell
Additional Information
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗