Plugin hooks fail on Windows: CLAUDE_PLUGIN_ROOT uses backslash paths incompatible with bash
Bug: Plugin hook CLAUDE_PLUGIN_ROOT uses Windows backslash paths, breaks /bin/bash execution
Description
On Windows, the ${CLAUDE_PLUGIN_ROOT} environment variable in plugin hook commands expands to a Windows-style path with backslashes (e.g., C:\Users\username\.claude\plugins\cache\...). When the hook is executed via /bin/bash (Git Bash), the backslashes are stripped, producing an invalid path like C:Userssapta.claudepluginscache....
This causes every plugin with a Stop hook to fail on every response, producing a visible error after each assistant message:
â—^O Ran 1 stop hook
⎿ Stop hook error: Failed with non-blocking status code: /bin/bash:
C:Userssapta.claudepluginscacheclaude-code-pluginsralph-wiggum1.0.0/hooks/stop-hook.sh:
No such file or directory
The hook file exists at the correct location and has proper execute permissions. The issue is purely the path separator handling.
Steps to Reproduce
- Install any plugin with a Stop hook on Windows (e.g.,
ralph-wiggum) - Run any Claude Code session
- Observe the stop hook error after each response
Expected Behavior
${CLAUDE_PLUGIN_ROOT} should be expanded with forward slashes (/) or the appropriate path format for the shell executing the hook. Since hooks are executed via /bin/bash on Windows (Git Bash), the path should use forward slashes.
Actual Behavior
${CLAUDE_PLUGIN_ROOT} expands with Windows backslashes (\), which bash interprets as escape characters, producing an invalid path.
Hook configuration (hooks.json)
{
hooks: {
Stop: [
{
hooks: [
{
type: command,
command: ${CLAUDE_PLUGIN_ROOT}/hooks/stop-hook.sh
}
]
}
]
}
}
Environment
- Claude Code: 2.1.42
- OS: Windows 11 Pro for Workstations (10.0.26220)
- Shell: bash (Git Bash via MSYS2)
- Plugin: ralph-wiggum 1.0.0 (affects any plugin with hooks)
- Plugin path: ~\.claude\plugins\cache\claude-code-plugins\ralph-wiggum\1.0.0\hooks\stop-hook.sh` (file exists, chmod +x)
Impact
- Non-blocking (doesn't break sessions), but produces a confusing error on every single response
- Affects all plugins with hooks on Windows, not just ralph-wiggum
- No user-side workaround since
CLAUDE_PLUGIN_ROOTis set by Claude Code internally
Suggested Fix
Normalize CLAUDE_PLUGIN_ROOT (and any other path variables passed to hooks) to use forward slashes on Windows before passing to the shell, e.g.:
pluginRoot = pluginRoot.replace(/\\/g, '/');
Or use the MSYS2/Git Bash compatible path format (/c/Users/... instead of C:\Users\...).
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗