mirror of
https://github.com/obra/superpowers.git
synced 2026-09-25 22:09:05 +00:00
SessionStart hook crashes on Windows without WSL #440
Labels
No labels
antigravity
automated-issue-report
brainstorming
bug
claude-code
codex
copilot
cursor
documentation
duplicate
enhancement
factory
gemini-cli
good first issue
help wanted
hermes
hooks
invalid
kiro
needs-categorization
needs-rebase-to-dev-branch
needs-repro-case
new-harness
no-obvious-human-review
opencode
pi
plans
pr-template-rules-ignored
question
skill:brainstorming
skill:diagnosing-superpowers
skill:dispatching-parallel-agents
skill:executing-plans
skill:finishing-a-development-branch
skill:receiving-code-review
skill:requesting-code-review
skills
skill:subagent-driven-development
skill:systematic-debugging
skill:test-driven-development
skill:using-git-worktrees
skill:using-superpowers
skill:verification-before-completion
skill:writing-plans
skill:writing-skills
stale
subagents
tdd
trae
triage
upstream-bug
windows
wontfix
worktrees
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
skills/obra-superpowers#440
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The
SessionStarthook (hooks/session-start.sh) fails on Windows machines that don't have WSL installed. Claude Code attempts to execute the bash script via WSL, which produces:This error occurs on every session startup, resume, clear, and compact event.
Environment
Root Cause
In
hooks/hooks.json, the command points directly to the.shfile:Claude Code 2.1.x auto-detects
.shfiles and prependsbashon Windows. Without WSL or Git Bash'sbashon PATH, this fails. The deprecatedrun-hook.cmdpolyglot wrapper notes this behavior change but the current setup still relies on bash being available.Suggested Fix
Add a
session-start.jsNode.js equivalent alongside the bash script, and use it on Windows. Node.js is guaranteed to be available since Claude Code itself requires it.Here's the Node.js port that produces identical output:
Then update
hooks.jsonto use the Node.js script:Alternatively,
hooks.jsoncould use platform-conditional commands if Claude Code supports that, or detect the platform at runtime.Workaround
Users can manually:
hooks/session-start.jswith the above contenthooks/hooks.jsonto point to the.jsfileTested and confirmed working on Windows with Node.js v20.x.
Same issue, slightly different scenario: WSL installed for Docker Desktop
I'm hitting the same error, but with a twist — WSL is installed on my machine, but only because Docker Desktop uses it as its backend. There are no Linux distros with a real bash shell:
What happens
Claude Code 2.1.42 auto-prepends
bashto.shhook commands on Windows. The systembashresolves toC:\Windows\System32\bash.exe(WSL shim), which intercepts the call. Since the docker-desktop WSL distro has no/bin/bash, it fails:Debug log shows:
The WSL error message pollutes stdout before the JSON output, so Claude Code can't parse the hook response.
Environment
C:\Program Files\Git\bin\bash.exeKey difference from the original report
Git Bash is available — just not at the path WSL intercepts. The
where bashoutput:My workaround
Created a
.cmdwrapper that explicitly calls Git Bash:hooks/session-start.cmd:hooks/hooks.json— changed command from.shto.cmd:This works because Claude Code doesn't prepend
bashto.cmdfiles.+1 for the Node.js solution
The Node.js approach suggested in the original issue is the best long-term fix — it avoids all bash/WSL/path issues on Windows since Node.js is guaranteed to be available.
Same issue, slightly different scenario: WSL installed for Docker Desktop
I'm hitting the same error, but with a twist — WSL is installed on my machine, but only because Docker Desktop uses it as its backend. There are no Linux distros with a real bash shell:
What happens
Claude Code 2.1.42 auto-prepends
bashto.shhook commands on Windows. The systembashresolves toC:\Windows\System32\bash.exe(WSL shim), which intercepts the call. Since the docker-desktop WSL distro has no/bin/bash, it fails:Debug log shows:
The WSL error message pollutes stdout before the JSON output, so Claude Code can't parse the hook response.
Environment
C:\Program Files\Git\bin\bash.exeKey difference from the original report
Git Bash is available — just not at the path WSL intercepts. The
where bashoutput:My workaround
Created a
.cmdwrapper that explicitly calls Git Bash:hooks/session-start.cmd:hooks/hooks.json— changed command from.shto.cmd:This works because Claude Code doesn't prepend
bashto.cmdfiles.+1 for the Node.js solution
The Node.js approach suggested in the original issue is the best long-term fix — it avoids all bash/WSL/path issues on Windows since Node.js is guaranteed to be available.