-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Description
Summary
The SessionStart hook in hooks/hooks.json fails on Windows because ${CLAUDE_PLUGIN_ROOT} expands with backslashes, which bash interprets as escape characters, mangling the path.
Error
Hook SessionStart:startup (SessionStart) error:
/bin/bash: C:Usersgtypa.claudepluginscacheclaude-plugins-officialsuperpowers4.3.0/hooks/session-start.sh: No such file or directory
Root Cause
- Claude Code expands
${CLAUDE_PLUGIN_ROOT}to Windows path:C:\Users\gtypa\.claude\plugins\cache\... - This path is passed to
/bin/bashas a command argument - Bash interprets
\U,\g,\p, etc. as escape sequences - Result:
C:Usersgtypa.claudepluginscache...— backslashes eaten, path broken
Environment
- OS: Windows 11
- Claude Code: 2.1.31
- Superpowers: 4.3.0
- Bash: Git Bash (
C:\Program Files\Git\bin\bash.exe)
Affected Code
hooks/hooks.json:
{
"hooks": {
"SessionStart": [
{
"matcher": "startup|resume|clear|compact",
"hooks": [
{
"type": "command",
"command": "${CLAUDE_PLUGIN_ROOT}/hooks/session-start.sh",
"async": false
}
]
}
]
}
}Suggested Fixes
Option 1: Path conversion in session-start.sh
The script already uses SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)" to derive the plugin root — this works correctly when bash can actually find the script. The problem is upstream.
Option 2: PowerShell wrapper on Windows
Detect platform and use PowerShell-based hooks on Windows, which handle native paths correctly.
Option 3: Request Claude Code fix
This may actually be a Claude Code bug — ${CLAUDE_PLUGIN_ROOT} should be converted to forward slashes before being passed to bash on Windows. Forward slashes work fine in Git Bash paths.
Workaround
Disabled the hook by renaming the key in hooks.json:
"_DISABLED_SessionStart_WINDOWS_PATH_BUG": [...]This prevents the error but loses the SessionStart functionality.