[BUG] ${CLAUDE_PLUGIN_ROOT} portability

Status Closed — not planned
Maintainer reply None cached
Activity 8 comments · opened Nov 19, 2025 · closed Mar 10, 2026

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_

View original on GitHub ↗

8 Comments

github-actions[bot] · 9 months ago

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.

ericallenpaul · 9 months ago

Confirming this bug is still present in Claude Code 2.1.7

Plugin: ralph-loop (official plugin)

  Error:
  ● Ran 1 stop hook
    ⎿  Stop hook error: Failed with non-blocking status code: /bin/bash:
       C:UsersERIC.PAUL.claudepluginscacheclaude-plugins-officialralph-loopf70b65538da0/hooks/stop-hook.sh: No such file or directory

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.

drolevar · 8 months ago

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.

gmd393-new · 8 months ago

I'm running into this issue as well.

Two Distinct Issues in #11984

Bug 1: Bash Selection (comment from drolevar)

  • WSL bash selected instead of Git Bash
  • WSL bash doesn't understand C:/Users/... paths
  • Fix: Reorder PATH to prioritize Git Bash
  • Your status: ✅ Already fixed - Git Bash is first

Bug 2: Path Separator Stripping (what I'm experiencing)

  • All backslashes removed from ${CLAUDE_PLUGIN_ROOT}
  • Expected: C:\Users\<user>\.claude\... or C:/Users/kdd9a/.claude/...
  • Actual: C:Users<user>.claude... (broken!)
  • Your status: ❌ Affected - no workaround except disabling plugin

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.

N0mikon · 8 months ago
I'm running into this issue as well. Two Distinct Issues in #11984 Bug 1: Bash Selection (comment from drolevar) WSL bash selected instead of Git Bash WSL bash doesn't understand C:/Users/... paths Fix: Reorder PATH to prioritize Git Bash Your status: ✅ Already fixed - Git Bash is first Bug 2: Path Separator Stripping (what I'm experiencing) All backslashes removed from ${CLAUDE_PLUGIN_ROOT} Expected: C:\Users<user>.claude... or C:/Users/kdd9a/.claude/... Actual: C:Users.claude... (broken!) Your status: ❌ Affected - no workaround except disabling plugin 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"

github-actions[bot] · 7 months ago

Closing for now — inactive for too long. Please open a new issue if this is still relevant.

Tim-Pohlmann · 7 months ago

This is still an issue.

github-actions[bot] · 6 months ago

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.