[BUG] ${CLAUDE_PLUGIN_ROOT} portability
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?
The plugin guide and example implementations suggest using the CLAUDE_PLUGIN_ROOT environment variable for portability. When running in Windows native (not WSL) CLAUDE_PLUGIN_ROOT is not compatible with bash paths.
When executing in cmd.exe, CLAUDE_PLUGIN_ROOT is set to a path that uses Windows-style back slashes. In Powershell, it uses forward slashes, but uses the C:/ prefix, which is also not compatible with bash.
CLAUDE_PLUGIN_ROOT should be normalized to work with Bash on all platforms.
What Should Happen?
Prompts that reference bundled scripts and execute them via bash should behave properly, regardless of operating system.
Error Messages/Logs
Steps to Reproduce
Create a plugin that has a bundled command which references and is instructed to execute a bundled shell script.
Follow the best practice guidance and reference the path to this bundled shell script using ${CLAUDE_PLUGIN_ROOT}/path/to/script.sh.
Install the plugin and execute the command. The command will likely fail to find the script because the unnormalized path will be malformed.
Claude Model
Not sure / Multiple models
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.0.47
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
_No response_
8 Comments
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
Confirming this bug is still present in Claude Code 2.1.7
Plugin: ralph-loop (official plugin)
Expected path:
C:\Users\ERIC.PAUL\.claude\plugins\cache\claude-plugins-official\ralph-loop\ee2f72662645\hooks\stop-hook.sh
Plugin's hooks.json uses the standard approach:
"command": "bash ${CLAUDE_PLUGIN_ROOT}/hooks/stop-hook.sh"
The backslashes in CLAUDE_PLUGIN_ROOT are being stripped when passed to bash, resulting in an invalid path. Converting to forward slashes before setting the environment variable would fix this.
Issue is that Claude expects (and probably is tested with) Git bash. However on my system (an probably others' too) the default in the path is WSL bash (
C:\Windows\System32\bash.exe). Once I fixed the PATH so that Git bash comes first, the issue is gone.I'm running into this issue as well.
Two Distinct Issues in #11984
Bug 1: Bash Selection (comment from drolevar)
Bug 2: Path Separator Stripping (what I'm experiencing)
My Bash Setup is Correct
✅ Active bash: Git Bash (MSYS) version 5.2.15
✅ PATH order: Git Bash comes FIRST
✅ WSL bash exists but isn't being used
The problem is in Claude Code's variable expansion itself, not bash selection.
Did you fix the path in Windows environment variables or specifically set the Claude path?
This fixed the issue for me:
setx CLAUDE_CODE_GIT_BASH_PATH "C:\Program Files\Git\bin\bash.exe"
Closing for now — inactive for too long. Please open a new issue if this is still relevant.
This is still an issue.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.