0
Fork 0
mirror of https://github.com/obra/superpowers.git synced 2026-09-25 22:09:05 +00:00

Windows: SessionStart hook fails due to Claude Code path handling bug #420

Closed
opened 2026-02-04 23:31:42 +00:00 by cmathew654-dot · 19 comments
cmathew654-dot commented 2026-02-04 23:31:42 +00:00 (Migrated from github.com)

filed w/ anthropic @ https://github.com/anthropics/claude-code/issues/23204

Summary

The superpowers SessionStart hook fails on Windows with
"hook error" message. This is caused by a Claude Code
bug (filed at anthropics/claude-code), but documenting
here for visibility and potential workaround.

Root Cause

Claude Code strips backslashes from
${CLAUDE_PLUGIN_ROOT} when substituting the variable
on Windows.

Expected path:
C:\Users\Cyril.claude\plugins\cache\claude-plugins-offic
ial\superpowers\4.1.1\hooks\session-start.sh

Actual path passed to bash:
C:UsersCyril.claudepluginscacheclaude-plugins-officialsu
perpowers4.1.1/hooks/session-start.sh

Error

SessionStart:startup hook error

Debug log shows:
/bin/bash: C:UsersCyril.claudepluginscacheclaude-plugins
-officialsuperpowers4.1.1/hooks/session-start.sh: No
such file or directory

Workaround

Replace ${CLAUDE_PLUGIN_ROOT} in hooks.json with a
hardcoded Unix-style path:

{
  "command": "/c/Users/USERNAME/path/to/superpowers/hook
s/session-start.sh"
}

Environment

- Windows 11
- Claude Code 2.1.31
filed w/ anthropic @ https://github.com/anthropics/claude-code/issues/23204 ## Summary The superpowers SessionStart hook fails on Windows with "hook error" message. This is caused by a Claude Code bug (filed at anthropics/claude-code), but documenting here for visibility and potential workaround. ## Root Cause Claude Code strips backslashes from `${CLAUDE_PLUGIN_ROOT}` when substituting the variable on Windows. **Expected path:** C:\Users\Cyril.claude\plugins\cache\claude-plugins-offic ial\superpowers\4.1.1\hooks\session-start.sh **Actual path passed to bash:** C:UsersCyril.claudepluginscacheclaude-plugins-officialsu perpowers4.1.1/hooks/session-start.sh ## Error SessionStart:startup hook error Debug log shows: /bin/bash: C:UsersCyril.claudepluginscacheclaude-plugins -officialsuperpowers4.1.1/hooks/session-start.sh: No such file or directory ## Workaround Replace `${CLAUDE_PLUGIN_ROOT}` in hooks.json with a hardcoded Unix-style path: ```json { "command": "/c/Users/USERNAME/path/to/superpowers/hook s/session-start.sh" } Environment - Windows 11 - Claude Code 2.1.31
AdamLMark commented 2026-02-05 03:24:20 +00:00 (Migrated from github.com)

Adding the async line worked for me from this

Adding the async line worked for me from [this](https://github.com/obra/superpowers/issues/404#issue-3893103357)
AdamLMark commented 2026-02-05 03:24:20 +00:00 (Migrated from github.com)

Adding the async line worked for me from this

Adding the async line worked for me from [this](https://github.com/obra/superpowers/issues/404#issue-3893103357)
AdamLMark commented 2026-02-05 03:24:20 +00:00 (Migrated from github.com)

Adding the async line worked for me from this

Adding the async line worked for me from [this](https://github.com/obra/superpowers/issues/404#issue-3893103357)
AdamLMark commented 2026-02-05 03:24:20 +00:00 (Migrated from github.com)

Adding the async line worked for me from this

Adding the async line worked for me from [this](https://github.com/obra/superpowers/issues/404#issue-3893103357)
losjoe commented 2026-02-05 13:49:19 +00:00 (Migrated from github.com)

Alternative workaround that's more portable

Instead of hardcoding the bash path in hooks.json, you can add bash to your PATH in Claude Code's settings.json:

%USERPROFILE%\.claude\settings.json:

{
  "env": {
    "PATH": "C:\\Program Files\\Git\\bin;C:\\Program Files\\Git\\usr\\bin;%PATH%",
    "MSYS_NO_PATHCONV": "1"
  }
}

Benefits:

  • Works for any Git Bash installation location
  • No need to modify plugin files (which get overwritten on updates)
  • MSYS_NO_PATHCONV=1 prevents path mangling issues
  • More maintainable across different systems

Note: Adjust the Git Bash path if your installation is in a different location.

## Alternative workaround that's more portable Instead of hardcoding the bash path in `hooks.json`, you can add bash to your PATH in Claude Code's `settings.json`: **`%USERPROFILE%\.claude\settings.json`:** ```json { "env": { "PATH": "C:\\Program Files\\Git\\bin;C:\\Program Files\\Git\\usr\\bin;%PATH%", "MSYS_NO_PATHCONV": "1" } } ``` **Benefits:** - Works for any Git Bash installation location - No need to modify plugin files (which get overwritten on updates) - `MSYS_NO_PATHCONV=1` prevents path mangling issues - More maintainable across different systems **Note:** Adjust the Git Bash path if your installation is in a different location.
losjoe commented 2026-02-05 13:49:19 +00:00 (Migrated from github.com)

Alternative workaround that's more portable

Instead of hardcoding the bash path in hooks.json, you can add bash to your PATH in Claude Code's settings.json:

%USERPROFILE%\.claude\settings.json:

{
  "env": {
    "PATH": "C:\\Program Files\\Git\\bin;C:\\Program Files\\Git\\usr\\bin;%PATH%",
    "MSYS_NO_PATHCONV": "1"
  }
}

Benefits:

  • Works for any Git Bash installation location
  • No need to modify plugin files (which get overwritten on updates)
  • MSYS_NO_PATHCONV=1 prevents path mangling issues
  • More maintainable across different systems

Note: Adjust the Git Bash path if your installation is in a different location.

## Alternative workaround that's more portable Instead of hardcoding the bash path in `hooks.json`, you can add bash to your PATH in Claude Code's `settings.json`: **`%USERPROFILE%\.claude\settings.json`:** ```json { "env": { "PATH": "C:\\Program Files\\Git\\bin;C:\\Program Files\\Git\\usr\\bin;%PATH%", "MSYS_NO_PATHCONV": "1" } } ``` **Benefits:** - Works for any Git Bash installation location - No need to modify plugin files (which get overwritten on updates) - `MSYS_NO_PATHCONV=1` prevents path mangling issues - More maintainable across different systems **Note:** Adjust the Git Bash path if your installation is in a different location.
losjoe commented 2026-02-05 13:49:19 +00:00 (Migrated from github.com)

Alternative workaround that's more portable

Instead of hardcoding the bash path in hooks.json, you can add bash to your PATH in Claude Code's settings.json:

%USERPROFILE%\.claude\settings.json:

{
  "env": {
    "PATH": "C:\\Program Files\\Git\\bin;C:\\Program Files\\Git\\usr\\bin;%PATH%",
    "MSYS_NO_PATHCONV": "1"
  }
}

Benefits:

  • Works for any Git Bash installation location
  • No need to modify plugin files (which get overwritten on updates)
  • MSYS_NO_PATHCONV=1 prevents path mangling issues
  • More maintainable across different systems

Note: Adjust the Git Bash path if your installation is in a different location.

## Alternative workaround that's more portable Instead of hardcoding the bash path in `hooks.json`, you can add bash to your PATH in Claude Code's `settings.json`: **`%USERPROFILE%\.claude\settings.json`:** ```json { "env": { "PATH": "C:\\Program Files\\Git\\bin;C:\\Program Files\\Git\\usr\\bin;%PATH%", "MSYS_NO_PATHCONV": "1" } } ``` **Benefits:** - Works for any Git Bash installation location - No need to modify plugin files (which get overwritten on updates) - `MSYS_NO_PATHCONV=1` prevents path mangling issues - More maintainable across different systems **Note:** Adjust the Git Bash path if your installation is in a different location.
obra commented 2026-02-05 19:53:57 +00:00 (Migrated from github.com)

Consolidation

This is now the canonical issue for the CLAUDE_PLUGIN_ROOT backslash-stripping bug on Windows.

The following related issues have been closed as duplicates:

  • #389 — SessionStart hook fails on Windows — bash cannot resolve ${CLAUDE_PLUGIN_ROOT} path
  • #399 — Windows: SessionStart hook fails due to CLAUDE_PLUGIN_ROOT path handling
  • #418 — SessionStart hook fails on Windows due to mixed path separators

Status

  • Root cause: Claude Code strips backslashes from ${CLAUDE_PLUGIN_ROOT} when substituting the variable on Windows. This is an upstream Claude Code bug.
  • Upstream issue: https://github.com/anthropics/claude-code/issues/23204
  • Workaround: Replace ${CLAUDE_PLUGIN_ROOT} in hooks.json with a hardcoded Unix-style path

Two other Windows SessionStart issues have been resolved:

  • 961052e: Added async: true to prevent TUI freeze when hook is slow/fails
  • 038abed: Replaced O(n²) escape_for_json with O(n) bash parameter substitution

This issue remains open until the upstream Claude Code fix lands.

## Consolidation This is now the canonical issue for the **CLAUDE_PLUGIN_ROOT backslash-stripping bug on Windows**. The following related issues have been closed as duplicates: - #389 — SessionStart hook fails on Windows — bash cannot resolve ${CLAUDE_PLUGIN_ROOT} path - #399 — Windows: SessionStart hook fails due to CLAUDE_PLUGIN_ROOT path handling - #418 — SessionStart hook fails on Windows due to mixed path separators ### Status - **Root cause:** Claude Code strips backslashes from `${CLAUDE_PLUGIN_ROOT}` when substituting the variable on Windows. This is an **upstream Claude Code bug**. - **Upstream issue:** https://github.com/anthropics/claude-code/issues/23204 - **Workaround:** Replace `${CLAUDE_PLUGIN_ROOT}` in hooks.json with a hardcoded Unix-style path ### Related fixes already shipped Two other Windows SessionStart issues have been resolved: - `961052e`: Added `async: true` to prevent TUI freeze when hook is slow/fails - `038abed`: Replaced O(n²) `escape_for_json` with O(n) bash parameter substitution This issue remains open until the upstream Claude Code fix lands.
obra commented 2026-02-05 19:53:57 +00:00 (Migrated from github.com)

Consolidation

This is now the canonical issue for the CLAUDE_PLUGIN_ROOT backslash-stripping bug on Windows.

The following related issues have been closed as duplicates:

  • #389 — SessionStart hook fails on Windows — bash cannot resolve ${CLAUDE_PLUGIN_ROOT} path
  • #399 — Windows: SessionStart hook fails due to CLAUDE_PLUGIN_ROOT path handling
  • #418 — SessionStart hook fails on Windows due to mixed path separators

Status

  • Root cause: Claude Code strips backslashes from ${CLAUDE_PLUGIN_ROOT} when substituting the variable on Windows. This is an upstream Claude Code bug.
  • Upstream issue: https://github.com/anthropics/claude-code/issues/23204
  • Workaround: Replace ${CLAUDE_PLUGIN_ROOT} in hooks.json with a hardcoded Unix-style path

Two other Windows SessionStart issues have been resolved:

  • 961052e: Added async: true to prevent TUI freeze when hook is slow/fails
  • 038abed: Replaced O(n²) escape_for_json with O(n) bash parameter substitution

This issue remains open until the upstream Claude Code fix lands.

## Consolidation This is now the canonical issue for the **CLAUDE_PLUGIN_ROOT backslash-stripping bug on Windows**. The following related issues have been closed as duplicates: - #389 — SessionStart hook fails on Windows — bash cannot resolve ${CLAUDE_PLUGIN_ROOT} path - #399 — Windows: SessionStart hook fails due to CLAUDE_PLUGIN_ROOT path handling - #418 — SessionStart hook fails on Windows due to mixed path separators ### Status - **Root cause:** Claude Code strips backslashes from `${CLAUDE_PLUGIN_ROOT}` when substituting the variable on Windows. This is an **upstream Claude Code bug**. - **Upstream issue:** https://github.com/anthropics/claude-code/issues/23204 - **Workaround:** Replace `${CLAUDE_PLUGIN_ROOT}` in hooks.json with a hardcoded Unix-style path ### Related fixes already shipped Two other Windows SessionStart issues have been resolved: - `961052e`: Added `async: true` to prevent TUI freeze when hook is slow/fails - `038abed`: Replaced O(n²) `escape_for_json` with O(n) bash parameter substitution This issue remains open until the upstream Claude Code fix lands.
obra commented 2026-02-05 19:53:57 +00:00 (Migrated from github.com)

Consolidation

This is now the canonical issue for the CLAUDE_PLUGIN_ROOT backslash-stripping bug on Windows.

The following related issues have been closed as duplicates:

  • #389 — SessionStart hook fails on Windows — bash cannot resolve ${CLAUDE_PLUGIN_ROOT} path
  • #399 — Windows: SessionStart hook fails due to CLAUDE_PLUGIN_ROOT path handling
  • #418 — SessionStart hook fails on Windows due to mixed path separators

Status

  • Root cause: Claude Code strips backslashes from ${CLAUDE_PLUGIN_ROOT} when substituting the variable on Windows. This is an upstream Claude Code bug.
  • Upstream issue: https://github.com/anthropics/claude-code/issues/23204
  • Workaround: Replace ${CLAUDE_PLUGIN_ROOT} in hooks.json with a hardcoded Unix-style path

Two other Windows SessionStart issues have been resolved:

  • 961052e: Added async: true to prevent TUI freeze when hook is slow/fails
  • 038abed: Replaced O(n²) escape_for_json with O(n) bash parameter substitution

This issue remains open until the upstream Claude Code fix lands.

## Consolidation This is now the canonical issue for the **CLAUDE_PLUGIN_ROOT backslash-stripping bug on Windows**. The following related issues have been closed as duplicates: - #389 — SessionStart hook fails on Windows — bash cannot resolve ${CLAUDE_PLUGIN_ROOT} path - #399 — Windows: SessionStart hook fails due to CLAUDE_PLUGIN_ROOT path handling - #418 — SessionStart hook fails on Windows due to mixed path separators ### Status - **Root cause:** Claude Code strips backslashes from `${CLAUDE_PLUGIN_ROOT}` when substituting the variable on Windows. This is an **upstream Claude Code bug**. - **Upstream issue:** https://github.com/anthropics/claude-code/issues/23204 - **Workaround:** Replace `${CLAUDE_PLUGIN_ROOT}` in hooks.json with a hardcoded Unix-style path ### Related fixes already shipped Two other Windows SessionStart issues have been resolved: - `961052e`: Added `async: true` to prevent TUI freeze when hook is slow/fails - `038abed`: Replaced O(n²) `escape_for_json` with O(n) bash parameter substitution This issue remains open until the upstream Claude Code fix lands.
pedropaulovc commented 2026-02-05 20:00:59 +00:00 (Migrated from github.com)

@obra Are you considering merging #421 or will you wait for an upstream fix in Claude Code? Let me know if you need anything before merging the PR.

@obra Are you considering merging #421 or will you wait for an upstream fix in Claude Code? Let me know if you need anything before merging the PR.
pedropaulovc commented 2026-02-05 20:00:59 +00:00 (Migrated from github.com)

@obra Are you considering merging #421 or will you wait for an upstream fix in Claude Code? Let me know if you need anything before merging the PR.

@obra Are you considering merging #421 or will you wait for an upstream fix in Claude Code? Let me know if you need anything before merging the PR.
pedropaulovc commented 2026-02-05 20:00:59 +00:00 (Migrated from github.com)

@obra Are you considering merging #421 or will you wait for an upstream fix in Claude Code? Let me know if you need anything before merging the PR.

@obra Are you considering merging #421 or will you wait for an upstream fix in Claude Code? Let me know if you need anything before merging the PR.
puneet1409 commented 2026-02-06 00:53:20 +00:00 (Migrated from github.com)

+1 — Hitting the same issue on Windows 11, Claude Code 2.1.32, Superpowers 4.1.1.

Error in debug log:

/bin/bash: C:/Users/<user>/.claude/plugins/cache/claude-plugins-official/superpowers/4.1.1/hooks/session-start.sh: No such file or directory

The file exists on disk — it's purely a path resolution issue when Claude Code auto-prepends bash for .sh files on Windows.

Local workaround: edit the cached hooks.json to explicitly call bash with an escaped Windows path:

"command": "bash \"C:\Users\<user>\.claude\plugins\cache\claude-plugins-official\superpowers\4.1.1\hooks\session-start.sh\""
+1 — Hitting the same issue on Windows 11, Claude Code 2.1.32, Superpowers 4.1.1. Error in debug log: ``` /bin/bash: C:/Users/<user>/.claude/plugins/cache/claude-plugins-official/superpowers/4.1.1/hooks/session-start.sh: No such file or directory ``` The file exists on disk — it's purely a path resolution issue when Claude Code auto-prepends `bash` for `.sh` files on Windows. Local workaround: edit the cached `hooks.json` to explicitly call `bash` with an escaped Windows path: ```json "command": "bash \"C:\Users\<user>\.claude\plugins\cache\claude-plugins-official\superpowers\4.1.1\hooks\session-start.sh\"" ```
puneet1409 commented 2026-02-06 00:53:20 +00:00 (Migrated from github.com)

+1 — Hitting the same issue on Windows 11, Claude Code 2.1.32, Superpowers 4.1.1.

Error in debug log:

/bin/bash: C:/Users/<user>/.claude/plugins/cache/claude-plugins-official/superpowers/4.1.1/hooks/session-start.sh: No such file or directory

The file exists on disk — it's purely a path resolution issue when Claude Code auto-prepends bash for .sh files on Windows.

Local workaround: edit the cached hooks.json to explicitly call bash with an escaped Windows path:

"command": "bash \"C:\Users\<user>\.claude\plugins\cache\claude-plugins-official\superpowers\4.1.1\hooks\session-start.sh\""
+1 — Hitting the same issue on Windows 11, Claude Code 2.1.32, Superpowers 4.1.1. Error in debug log: ``` /bin/bash: C:/Users/<user>/.claude/plugins/cache/claude-plugins-official/superpowers/4.1.1/hooks/session-start.sh: No such file or directory ``` The file exists on disk — it's purely a path resolution issue when Claude Code auto-prepends `bash` for `.sh` files on Windows. Local workaround: edit the cached `hooks.json` to explicitly call `bash` with an escaped Windows path: ```json "command": "bash \"C:\Users\<user>\.claude\plugins\cache\claude-plugins-official\superpowers\4.1.1\hooks\session-start.sh\"" ```
puneet1409 commented 2026-02-06 00:53:20 +00:00 (Migrated from github.com)

+1 — Hitting the same issue on Windows 11, Claude Code 2.1.32, Superpowers 4.1.1.

Error in debug log:

/bin/bash: C:/Users/<user>/.claude/plugins/cache/claude-plugins-official/superpowers/4.1.1/hooks/session-start.sh: No such file or directory

The file exists on disk — it's purely a path resolution issue when Claude Code auto-prepends bash for .sh files on Windows.

Local workaround: edit the cached hooks.json to explicitly call bash with an escaped Windows path:

"command": "bash \"C:\Users\<user>\.claude\plugins\cache\claude-plugins-official\superpowers\4.1.1\hooks\session-start.sh\""
+1 — Hitting the same issue on Windows 11, Claude Code 2.1.32, Superpowers 4.1.1. Error in debug log: ``` /bin/bash: C:/Users/<user>/.claude/plugins/cache/claude-plugins-official/superpowers/4.1.1/hooks/session-start.sh: No such file or directory ``` The file exists on disk — it's purely a path resolution issue when Claude Code auto-prepends `bash` for `.sh` files on Windows. Local workaround: edit the cached `hooks.json` to explicitly call `bash` with an escaped Windows path: ```json "command": "bash \"C:\Users\<user>\.claude\plugins\cache\claude-plugins-official\superpowers\4.1.1\hooks\session-start.sh\"" ```
pedropaulovc commented 2026-02-07 20:06:45 +00:00 (Migrated from github.com)

@obra Could you please reconsider applying the the fix from #421 while we wait for CC upstream fixes? Windows is not a priority for them. For instance, LSP for C# and TS are broken too for >30 days (https://github.com/anthropics/claude-code/issues/15914#issuecomment-3721465887). The fact that you get a constant stream of reports from different users hitting the same issue is a sign that this is a worthwhile fix.

@obra Could you please reconsider applying the the fix from #421 while we wait for CC upstream fixes? Windows is not a priority for them. For instance, LSP for C# and TS are broken too for >30 days (https://github.com/anthropics/claude-code/issues/15914#issuecomment-3721465887). The fact that you get a constant stream of reports from different users hitting the same issue is a sign that this is a worthwhile fix.
pedropaulovc commented 2026-02-07 20:06:45 +00:00 (Migrated from github.com)

@obra Could you please reconsider applying the the fix from #421 while we wait for CC upstream fixes? Windows is not a priority for them. For instance, LSP for C# and TS are broken too for >30 days (https://github.com/anthropics/claude-code/issues/15914#issuecomment-3721465887). The fact that you get a constant stream of reports from different users hitting the same issue is a sign that this is a worthwhile fix.

@obra Could you please reconsider applying the the fix from #421 while we wait for CC upstream fixes? Windows is not a priority for them. For instance, LSP for C# and TS are broken too for >30 days (https://github.com/anthropics/claude-code/issues/15914#issuecomment-3721465887). The fact that you get a constant stream of reports from different users hitting the same issue is a sign that this is a worthwhile fix.
Boysiee commented 2026-02-14 14:47:38 +00:00 (Migrated from github.com)

Better workaround: .cmd wrapper (no hardcoding needed)

Instead of hardcoding the path (which breaks on plugin version updates), you can create a small batch wrapper that resolves the path natively on Windows.

1. Create hooks/session-start.cmd in the superpowers plugin directory:

@echo off
"C:\Program Files\Git\bin\bash.exe" "%~dp0session-start.sh" %*
exit /b

%~dp0 resolves to the directory of the .cmd file itself, so it always finds session-start.sh next to it — no hardcoded paths, no ${CLAUDE_PLUGIN_ROOT} backslash issues.

2. Update hooks/hooks.json — change the command from:

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

to:

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

Claude Code doesn't auto-prepend bash for .cmd files, so the backslash stripping never happens. Windows runs the .cmd natively, which then explicitly calls Git Bash with the correct path.

Why this is better than hardcoding:

  • Survives plugin version changes (no absolute path to break)
  • Works across different Windows usernames/install locations
  • Only 3 lines to add

Note: Plugin auto-updates will overwrite both files, so you'll need to re-apply after updates until the upstream Claude Code bug (anthropics/claude-code#23204) is fixed.

## Better workaround: `.cmd` wrapper (no hardcoding needed) Instead of hardcoding the path (which breaks on plugin version updates), you can create a small batch wrapper that resolves the path natively on Windows. **1. Create `hooks/session-start.cmd`** in the superpowers plugin directory: ```cmd @echo off "C:\Program Files\Git\bin\bash.exe" "%~dp0session-start.sh" %* exit /b ``` `%~dp0` resolves to the directory of the `.cmd` file itself, so it always finds `session-start.sh` next to it — no hardcoded paths, no `${CLAUDE_PLUGIN_ROOT}` backslash issues. **2. Update `hooks/hooks.json`** — change the command from: ```json "command": "${CLAUDE_PLUGIN_ROOT}/hooks/session-start.sh" ``` to: ```json "command": "${CLAUDE_PLUGIN_ROOT}/hooks/session-start.cmd" ``` Claude Code doesn't auto-prepend `bash` for `.cmd` files, so the backslash stripping never happens. Windows runs the `.cmd` natively, which then explicitly calls Git Bash with the correct path. **Why this is better than hardcoding:** - Survives plugin version changes (no absolute path to break) - Works across different Windows usernames/install locations - Only 3 lines to add **Note:** Plugin auto-updates will overwrite both files, so you'll need to re-apply after updates until the upstream Claude Code bug (anthropics/claude-code#23204) is fixed.
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
skills/obra-superpowers#420
No description provided.