Plugin hooks cannot execute scripts on Windows - /bin/bash cannot resolve file paths
Description
Plugin hooks that reference script files fail on Windows because Claude Code's /bin/bash cannot resolve Windows file paths in any format.
Environment
- OS: Windows 11
- Claude Code version: Latest
- Shell: PowerShell (terminal), but hooks use
/bin/bash
Steps to Reproduce
- Install a plugin that uses hook scripts (e.g.,
codex-peer-reviewfrom the marketplace) - The plugin's
hooks.jsonreferences a script file:
``json``
{
"hooks": {
"Stop": [{
"matcher": "*",
"hooks": [{
"type": "command",
"command": "bash \"C:\Users\username\.claude\plugins\cache\plugin-name\1.0.0\hooks\script.sh\""
}]
}]
}
}
- Start a Claude Code session and trigger the hook
Expected Behavior
The hook script should execute successfully.
Actual Behavior
The hook fails with an error like:
Stop hook error: Failed with non-blocking status code: /bin/bash: C:Usersusername.claudeplugins...: No such file or directory
Path Formats Tested (All Failed)
| Format | Result |
|--------|--------|
| C:\Users\... | Backslashes stripped: C:Users... |
| "C:\Users\..." (quoted) | Mixed separators: C:\...\1.0.0/hooks/... |
| C:/Users/... | /bin/bash: C:/Users/...: No such file or directory |
| /c/Users/... (MSYS style) | /bin/bash: /c/Users/...: No such file or directory |
| cygpath -u | cygpath: command not found (not in PATH) |
Workaround
Replace script references with inline echo commands. This makes hooks succeed but removes their functionality.
Analysis
Claude Code appears to use a /bin/bash that:
- Is not Git Bash or MSYS bash (no
cygpathavailable) - Cannot resolve Windows absolute paths in any format
- Strips backslashes from unquoted paths
- Cannot find files at forward-slash Windows paths
This makes it impossible for plugins to use hook scripts on Windows - only inline commands work.
Suggested Fix
Either:
- Use a bash that can resolve Windows paths (Git Bash, MSYS2)
- Automatically convert Windows paths to a resolvable format before passing to bash
- Allow
cmd.exeor PowerShell as an alternative hook executor on Windows - Document the limitation and recommend inline commands for cross-platform plugins
This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗