superpowers icon indicating copy to clipboard operation
superpowers copied to clipboard

[Bug] SessionStart:startup hook error

Open LightYear512 opened this issue 10 months ago • 16 comments

Describe the bug Claude Code show the error when start:

SessionStart:startup hook error: Failed with non-blocking status code: /bin/bash: C:\Users<username>.claude\plugins\cache\superpowers-marketplace\superpowers\4.0.3/hooks/run-hook.cmd: No such file or directory

To Reproduce Steps to reproduce the behavior:

  1. install plugin
  2. use "claude --verbose" to show the detailed error message

Expected behavior No Error

Logs No Log

Additional context Claude Code version: 2.1.9 Windows Version: Windows 11 Pro 25H2

LightYear512 avatar Jan 16 '26 03:01 LightYear512

It's happening to me now too.

executorrr86 avatar Jan 16 '26 10:01 executorrr86

I usually work on macOS, but I hit the same issue on Windows after the Claude 2.0.19 update.

In my case, the problem was that bash was not available in PATH, and the Hook is using bash shebang which seems causing issues on windows.

Fix:

  1. Press Win + R → sysdm.cpl
  2. Advanced tab → Environment Variables
  3. Under System variables, select Path → Edit
  4. New & add the following paths:
C:\Program Files\Git\bin
C:\Program Files\Git\usr\bin
  1. Restart your terminal
  2. Verify with:
where bash
bash --version

After adding Bash to PATH, the issue was resolved for me.

denisdasilvarocha avatar Jan 16 '26 11:01 denisdasilvarocha

It worked for me, thanks you . I followed the steps exactly as described by denisdasilvarocha, and now I no longer get the error message.

executorrr86 avatar Jan 16 '26 15:01 executorrr86

It's still doesn't work for me. where bash return nothing for me.

rayjoy avatar Jan 16 '26 15:01 rayjoy

@rayjoy If where bash returns nothing, it means you don't have Git Bash installed on your system. Here's how to fix it:

Solution: Install Git for Windows

Step 1: Download and Install Git

  1. Go to https://git-scm.com/download/win
  2. Download the latest version for Windows
  3. Run the installer
  4. Important: During installation, make sure to select:
    • ✅ "Git from the command line and also from 3rd-party software" (this adds Git to PATH automatically)
    • ✅ "Use Git and optional Unix tools from the Command Prompt" (recommended)

Step 2: Verify Installation

After installation, open a new Command Prompt or PowerShell and run:

where bash
bash --version

You should see output like:

C:\Program Files\Git\bin\bash.exe
C:\Program Files\Git\usr\bin\bash.exe
GNU bash, version 5.x.x

Step 3: Manually Add to PATH (If Needed)

If where bash still returns nothing after installing Git, manually add to PATH:

  1. Press Win + R → type sysdm.cpl → Enter
  2. Go to Advanced tab → Click Environment Variables
  3. Under System variables, select Path → Click Edit
  4. Click New and add these two paths:
    C:\Program Files\Git\bin
    C:\Program Files\Git\usr\bin
    
  5. Click OK on all dialogs
  6. Important: Close and reopen your terminal/Claude Code completely

Step 4: Restart Claude Code

After adding bash to PATH, restart Claude Code completely for the changes to take effect.

Alternative: Use WSL (Windows Subsystem for Linux)

If you prefer, you can use WSL instead:

  1. Open PowerShell as Administrator
  2. Run: wsl --install
  3. Restart your computer
  4. WSL's bash will be available in PATH

This should resolve the SessionStart:startup hook error!

nabilW avatar Jan 16 '26 15:01 nabilW

Receiving the same error. Followed steps above with no luck. Screenshots provided

The file mentioned does exist. Does it mean anything important that the slashes change direction in the --verbose output?

Image Image Image

PrintsCharming avatar Jan 16 '26 22:01 PrintsCharming

@rayjoy If where bash returns nothing, it means you don't have Git Bash installed on your system. Here's how to fix it:

Solution: Install Git for Windows

Step 1: Download and Install Git

1. Go to https://git-scm.com/download/win

2. Download the latest version for Windows

3. Run the installer

4. **Important**: During installation, make sure to select:
   
   * ✅ "Git from the command line and also from 3rd-party software" (this adds Git to PATH automatically)
   * ✅ "Use Git and optional Unix tools from the Command Prompt" (recommended)

Step 2: Verify Installation

After installation, open a new Command Prompt or PowerShell and run:

where bash bash --version

You should see output like:

C:\Program Files\Git\bin\bash.exe
C:\Program Files\Git\usr\bin\bash.exe
GNU bash, version 5.x.x

Step 3: Manually Add to PATH (If Needed)

If where bash still returns nothing after installing Git, manually add to PATH:

1. Press `Win + R` → type `sysdm.cpl` → Enter

2. Go to **Advanced** tab → Click **Environment Variables**

3. Under **System variables**, select **Path** → Click **Edit**

4. Click **New** and add these two paths:
   ```
   C:\Program Files\Git\bin
   C:\Program Files\Git\usr\bin
   ```

5. Click **OK** on all dialogs

6. **Important**: Close and reopen your terminal/Claude Code completely

Step 4: Restart Claude Code

After adding bash to PATH, restart Claude Code completely for the changes to take effect.

Alternative: Use WSL (Windows Subsystem for Linux)

If you prefer, you can use WSL instead:

1. Open PowerShell as Administrator

2. Run: `wsl --install`

3. Restart your computer

4. WSL's bash will be available in PATH

This should resolve the SessionStart:startup hook error!

Neither of this worked. And DO NOT install git with the "✅ "Use Git and optional Unix tools from the Command Prompt" (recommended)" option, as that COMPLETELY destroys your entire terminal system on windows, and especially claude code, for me causing the corrupted rendering of the terminals constantly out of nowhere which it never did before, particularly breaking plugins that.. haha.. have bash-style commands and are based on that, go figure, more on that in a moment (there's a reason why that specific installation option says "Warning" in bold, dark red font, advising you to pick that only when you know what you're doing...). Instead just leave it on the default "✅ "Git from the command line and also from 3rd-party software" (this adds Git to PATH automatically)". And what I did to fix the "where bash" etc. not showing up, and some dumbass "WSL" error when you try to type bash --version, is to just install the latest ubuntu WSL distro, and set it as my default (you should do it especially if you also have docker desktop installed, which I do), that fixed the bash commands for me.

As for the plugin hook stuff, 😬 yeah that's unfortunate because as far as I understood, as impressively idiotic as it is, that apparently happens exactly because the commands in some plugins' python files or whatever, have purely bash-style commands, in that their slashes are flipped in the opposite direction than windows would want, despite shipping with a cmd version seemingly, that just.. never gets used apparently lol. So all I did to fix that, was to essentially just flip them around, and to make sure, write a small python "windows compatible" wrapper and modify the plugin to run that during every use for every single skill. It's impressively embarrassing that the user has to do any of that, but it is what it is I guess. You could ironically get Claude to do it for you, if you wanted to, and it seems to do a decent job of it, I am back up and running now.

pearuarmasj avatar Jan 17 '26 00:01 pearuarmasj

The solution from @denisdasilvarocha worked for me on Windows 10.

Now the hook runs successfully:

SessionStart:resume hook success: Success

Thanks for the solution!

huansbox avatar Jan 17 '26 02:01 huansbox

So sadly! The solution from @denisdasilvarocha is not worked for me.

@pearuarmasj Is SessionStart is worked on your PC ? Can you share what you have done?

I ensure it that I choose "Git from the command line and also from 3rd-party software" option.

LightYear512 avatar Jan 17 '26 03:01 LightYear512

@LightYear512 the "/bin/bash:" at the start of the error message indicates that git bash is not your default bash. You probably use WSL bash which cannot run "session-start.sh" this way. you can confirm this by opening a CMD terminal and run where bash command. The first one in the list should be pointing to the git bash for this to work. but you'll probably see something like this as the first entry: C:\Users\<Your User>\AppData\Local\Microsoft\WindowsApps\bash.exe

As a temp fix, run this in windows powershell: $env:PATH="C:\Program Files\Git\bin\;$env:PATH";claude

zeynalnia avatar Jan 17 '26 06:01 zeynalnia

Root Cause

The issue occurs when WSL's bash.exe is the default shell on Windows. Claude Code passes Windows-style paths (e.g., C:\Users\...) to the hook command, but WSL bash cannot resolve these paths - it expects Unix-style paths like /mnt/c/Users/....

How to Reproduce

The error happens when either:

  1. Only WSL's bash.exe is in PATH - Windows has no Git Bash installed, or Git Bash is not in PATH
  2. Both WSL and Git bash.exe are in PATH, but WSL comes first - Windows resolves bash to WSL's version

Fix

PR #282 adds wslpath -u to convert Windows paths to WSL format before executing the hook, with a fallback to the original path for non-WSL environments (native Linux/macOS or Windows with Git Bash).

zeynalnia avatar Jan 17 '26 09:01 zeynalnia

This sure sounds like a newly introduced bug in Claude due to their path handling.

obra avatar Jan 19 '26 01:01 obra

This issue is resolved by PR #331.

Root cause: Claude Code 2.1.x changed how hooks are executed on Windows. It now auto-detects .sh files and prepends bash to the command. However, when using the polyglot wrapper (run-hook.cmd), this resulted in:

bash "C:\Users\<username>\.claude\plugins\...\run-hook.cmd" session-start.sh

Bash cannot execute a .cmd file, hence the "No such file or directory" error when bash tried to interpret the Windows path.

Fix: PR #331 updates hooks.json to call session-start.sh directly:

"command": "${CLAUDE_PLUGIN_ROOT}/hooks/session-start.sh"

Claude Code 2.1.x now automatically handles the bash invocation on Windows, so the polyglot wrapper is no longer needed.

obra avatar Jan 22 '26 20:01 obra

Closed by PR #331

obra avatar Jan 22 '26 20:01 obra

Hey, I'm on Claude Code v2.1.32 with win11 - still same issue here. the fixes introduced here did not help for me. can we reopen this issue?

▐▛███▜▌ Claude Code v2.1.32 ▝▜█████▛▘ Opus 4.6 · Claude Max ▘▘ ▝▝ C:\mypart_sc\postman ⎿ SessionStart:startup hook error

blakazulu avatar Feb 22 '26 10:02 blakazulu

All you need to do is tell Claude to use cmd instead of PowerShell when calling load-global-skills.ps1. The PowerShell environment on Windows 10 is both messy and inefficient.

Shi-Qizhang avatar May 14 '26 10:05 Shi-Qizhang