Windows: Plugin hooks fail due to path escaping - backslashes stripped from CLAUDE_PLUGIN_ROOT
Bug Report: Windows path escaping broken in plugin hooks
Summary
On Windows, plugin hooks that use ${CLAUDE_PLUGIN_ROOT} with shell scripts (.sh) fail because Windows paths lose their backslashes, resulting in invalid paths like C:Usersdkohut... instead of C:\Users\dkohut\... or /c/Users/dkohut/....
Environment
- Claude Code version: 2.1.31
- Platform: Windows 11 (win32)
- Bash: Git Bash (
C:\Program Files\Git\bin\bash.exe) - Affected plugins:
superpowers@claude-plugins-official(v4.1.1)explanatory-output-style@claude-plugins-official(27d2b86d72da)
Steps to Reproduce
- Install Claude Code 2.1.31 on Windows
- Enable
superpowersorexplanatory-output-styleplugin - Start Claude Code with debug mode (
--debug) - Observe startup hook errors
Expected Behavior
The ${CLAUDE_PLUGIN_ROOT} variable should expand to a valid path that bash can understand on Windows, either:
- Unix-style path:
/c/Users/dkohut/.claude/plugins/cache/... - Or properly escaped Windows path
Actual Behavior
The path loses all backslashes and becomes invalid:
/bin/bash: C:Usersdkohut.claudepluginscacheclaude-plugins-officialsuperpowers4.1.1/hooks/session-start.sh: No such file or directory
The path C:Usersdkohut... has:
C:without following backslash- All directory separators stripped
Debug Log Evidence
2026-02-05T08:22:08.286Z [DEBUG] Hook output does not start with {, treating as plain text
2026-02-05T08:22:08.287Z [DEBUG] Hook SessionStart:startup (SessionStart) error:
wsl: Neznámá klávesa 'experimental.useWindowsDnsCache' v C:\Users\dkohut\.wslconfig:33
wsl: Nastavení wsl2.localhostForwarding nemá žádný vliv při použití zrcadleného síťového režimu
/bin/bash: C:Usersdkohut.claudepluginscacheclaude-plugins-officialsuperpowers4.1.1/hooks/session-start.sh: No such file or directory
2026-02-05T08:22:08.301Z [DEBUG] Hook output does not start with {, treating as plain text
2026-02-05T08:22:08.302Z [DEBUG] Hook SessionStart:startup (SessionStart) error:
/bin/bash: C:Usersdkohut.claudepluginscacheclaude-plugins-officialexplanatory-output-style27d2b86d72da/hooks-handlers/session-start.sh: No such file or directory
Hook Configuration
Both plugins use standard hook configuration with ${CLAUDE_PLUGIN_ROOT}:
superpowers/hooks/hooks.json:
{
"hooks": {
"SessionStart": [
{
"matcher": "startup|resume|clear|compact",
"hooks": [
{
"type": "command",
"command": "${CLAUDE_PLUGIN_ROOT}/hooks/session-start.sh"
}
]
}
]
}
}
Additional Context
The run-hook.cmd file in superpowers mentions that Claude Code 2.1.x changed execution model:
Claude Code 2.1.x changed the Windows execution model for hooks: After (2.1.x): Claude Code now auto-detects .sh files in hook commands and prepends "bash " on Windows.
The auto-detection works (bash is invoked), but the path passed to bash is malformed.
Suggested Fix
When expanding ${CLAUDE_PLUGIN_ROOT} on Windows for bash execution, the path should be converted to Unix-style format:
C:\Users\dkohut\.claude\...→/c/Users/dkohut/.claude/...
Or ensure proper escaping when the path contains backslashes.
Workaround
Disable affected plugins:
{
"enabledPlugins": {
"superpowers@claude-plugins-official": false,
"explanatory-output-style@claude-plugins-official": false
}
}This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗