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

SessionStart hook freezes terminal on Windows (bash not in PATH) #414

Closed
opened 2026-02-04 13:09:01 +00:00 by tdashelby-cmyk · 11 comments
tdashelby-cmyk commented 2026-02-04 13:09:01 +00:00 (Migrated from github.com)

Bug Report

The superpowers plugin's SessionStart hook causes Claude Code's terminal to completely freeze on Windows, making the terminal unresponsive to all input including Ctrl+C.

Environment

  • OS: Windows 10/11
  • Claude Code version: 2.1.31
  • Superpowers plugin version: 4.1.1
  • Terminal: Tested in both Windows Terminal and PowerShell — same behavior in both

Problem

The SessionStart hook in hooks/hooks.json runs a bash shell script:

{
  "hooks": {
    "SessionStart": [
      {
        "matcher": "startup|resume|clear|compact",
        "hooks": [
          {
            "type": "command",
            "command": "${CLAUDE_PLUGIN_ROOT}/hooks/session-start.sh"
          }
        ]
      }
    ]
  }
}

On Windows, bash is not in the PATH for hook execution, so this fails with:

'bash' is not recognized as an internal or external command,
operable program or batch file.

In many cases this error resolves quickly and Claude Code continues normally. However, intermittently the hook execution hangs instead of failing, which completely locks the terminal — no keyboard input is accepted, and Ctrl+C does not work. The user must kill the terminal process externally.

Reproduction

  1. Install the superpowers plugin on Windows
  2. Launch claude from various directories
  3. The terminal will intermittently freeze after the UI renders (REPL mounts, UI is visible, but no input accepted)

Evidence from debug logs

The debug logs consistently show:

Hook output does not start with {, treating as plain text
Hook SessionStart:startup (SessionStart) error:
'bash' is not recognized as an internal or external command,
operable program or batch file.

Sessions that don't freeze show this error followed by normal REPL mount. Sessions that do freeze appear identical in the logs up to the hook execution point.

Workaround

Disabling the superpowers plugin in ~/.claude/settings.json resolves the issue:

{
  "enabledPlugins": {
    "superpowers@claude-plugins-official": false
  }
}

Suggested Fix

The hook should either:

  • Provide a Windows-compatible alternative (.cmd / .ps1 script)
  • Use a cross-platform execution method
  • Detect the OS and skip gracefully on Windows
## Bug Report The superpowers plugin's `SessionStart` hook causes Claude Code's terminal to completely freeze on Windows, making the terminal unresponsive to all input including Ctrl+C. ## Environment - **OS:** Windows 10/11 - **Claude Code version:** 2.1.31 - **Superpowers plugin version:** 4.1.1 - **Terminal:** Tested in both Windows Terminal and PowerShell — same behavior in both ## Problem The `SessionStart` hook in `hooks/hooks.json` runs a bash shell script: ```json { "hooks": { "SessionStart": [ { "matcher": "startup|resume|clear|compact", "hooks": [ { "type": "command", "command": "${CLAUDE_PLUGIN_ROOT}/hooks/session-start.sh" } ] } ] } } ``` On Windows, `bash` is not in the PATH for hook execution, so this fails with: ``` 'bash' is not recognized as an internal or external command, operable program or batch file. ``` In many cases this error resolves quickly and Claude Code continues normally. However, **intermittently the hook execution hangs instead of failing**, which completely locks the terminal — no keyboard input is accepted, and Ctrl+C does not work. The user must kill the terminal process externally. ## Reproduction 1. Install the superpowers plugin on Windows 2. Launch `claude` from various directories 3. The terminal will intermittently freeze after the UI renders (REPL mounts, UI is visible, but no input accepted) ## Evidence from debug logs The debug logs consistently show: ``` Hook output does not start with {, treating as plain text Hook SessionStart:startup (SessionStart) error: 'bash' is not recognized as an internal or external command, operable program or batch file. ``` Sessions that don't freeze show this error followed by normal REPL mount. Sessions that do freeze appear identical in the logs up to the hook execution point. ## Workaround Disabling the superpowers plugin in `~/.claude/settings.json` resolves the issue: ```json { "enabledPlugins": { "superpowers@claude-plugins-official": false } } ``` ## Suggested Fix The hook should either: - Provide a Windows-compatible alternative (`.cmd` / `.ps1` script) - Use a cross-platform execution method - Detect the OS and skip gracefully on Windows
tdashelby-cmyk commented 2026-02-04 13:11:10 +00:00 (Migrated from github.com)

Note: This issue was diagnosed and written by Claude Code (Claude Opus 4.5) during a troubleshooting session with the user. The debug log analysis and reproduction steps reflect what we found together in that session.

**Note:** This issue was diagnosed and written by Claude Code (Claude Opus 4.5) during a troubleshooting session with the user. The debug log analysis and reproduction steps reflect what we found together in that session.
tdashelby-cmyk commented 2026-02-04 13:11:10 +00:00 (Migrated from github.com)

Note: This issue was diagnosed and written by Claude Code (Claude Opus 4.5) during a troubleshooting session with the user. The debug log analysis and reproduction steps reflect what we found together in that session.

**Note:** This issue was diagnosed and written by Claude Code (Claude Opus 4.5) during a troubleshooting session with the user. The debug log analysis and reproduction steps reflect what we found together in that session.
7sharp9 commented 2026-02-04 13:13:26 +00:00 (Migrated from github.com)

I haven't been getting this until today, I'm not sure anything updated. I guess I have just been lucky until today.

Windows 11 with PowerShell 7

I haven't been getting this until today, I'm not sure anything updated. I guess I have just been lucky until today. Windows 11 with PowerShell 7
7sharp9 commented 2026-02-04 13:13:26 +00:00 (Migrated from github.com)

I haven't been getting this until today, I'm not sure anything updated. I guess I have just been lucky until today.

Windows 11 with PowerShell 7

I haven't been getting this until today, I'm not sure anything updated. I guess I have just been lucky until today. Windows 11 with PowerShell 7
xiaosongz commented 2026-02-04 14:53:45 +00:00 (Migrated from github.com)

Additional confirmation — freeze happens even when bash IS in PATH

Our environment has Git Bash properly installed and in PATH (bash 5.2.37, MSYS2), yet the same freeze occurs on Claude Code v2.1.30. So the problem has at least two triggers:

  1. Bash not in PATH (your case) — hook command fails immediately, but the error still freezes the CLI
  2. Bash in PATH but hook runs too slowly (our case / #404) — the session-start.sh script's escape_for_json function does character-by-character iteration in pure bash, which is extremely slow on Windows. This blocks the Ink TUI from entering raw mode for stdin.

In both cases, the result is the same: terminal is completely unresponsive.

Issue #404 reports the same freeze but attributes it to VSCode. It actually affects all Windows terminals — VSCode, Windows Terminal, Git Bash, PowerShell. I'd suggest these two issues be linked or merged, as they share the same root cause: the SessionStart hook running synchronously blocks the TUI.

Two-sided problem

We filed anthropics/claude-code#22934 for the Claude Code side — the core CLI should never freeze when a hook fails or runs slowly. But the plugin side also needs a fix:

  • Ship a cross-platform hook (Node.js instead of bash), or
  • Add "async": true to the hook definition by default (confirmed working in #404), or
  • Detect Windows and use a .cmd/.ps1 alternative

Workarounds

  1. Add async: true to the SessionStart hook in hooks/hooks.json (quick fix, confirmed in #404)
  2. Disable the plugin: "superpowers@claude-plugins-official": false in ~/.claude/settings.json
  3. Clean large session files: find ~/.claude/projects -name "*.jsonl" -size +10M -delete (reduces hang severity)
## Additional confirmation — freeze happens even when bash IS in PATH Our environment has Git Bash properly installed and in PATH (`bash 5.2.37, MSYS2`), yet the same freeze occurs on Claude Code v2.1.30. So the problem has at least two triggers: 1. **Bash not in PATH** (your case) — hook command fails immediately, but the error still freezes the CLI 2. **Bash in PATH but hook runs too slowly** (our case / #404) — the `session-start.sh` script's `escape_for_json` function does character-by-character iteration in pure bash, which is extremely slow on Windows. This blocks the Ink TUI from entering raw mode for stdin. In both cases, the result is the same: **terminal is completely unresponsive**. ### This is related to #404 Issue #404 reports the same freeze but attributes it to VSCode. It actually affects all Windows terminals — VSCode, Windows Terminal, Git Bash, PowerShell. I'd suggest these two issues be linked or merged, as they share the same root cause: the SessionStart hook running synchronously blocks the TUI. ### Two-sided problem We filed [anthropics/claude-code#22934](https://github.com/anthropics/claude-code/issues/22934) for the **Claude Code side** — the core CLI should never freeze when a hook fails or runs slowly. But the **plugin side** also needs a fix: - Ship a cross-platform hook (Node.js instead of bash), or - Add `"async": true` to the hook definition by default (confirmed working in #404), or - Detect Windows and use a `.cmd`/`.ps1` alternative ### Workarounds 1. **Add `async: true`** to the SessionStart hook in `hooks/hooks.json` (quick fix, confirmed in #404) 2. **Disable the plugin**: `"superpowers@claude-plugins-official": false` in `~/.claude/settings.json` 3. **Clean large session files**: `find ~/.claude/projects -name "*.jsonl" -size +10M -delete` (reduces hang severity) ### Related - [anthropics/claude-code#22934](https://github.com/anthropics/claude-code/issues/22934) — Detailed freeze regression report - [anthropics/claude-code#22906](https://github.com/anthropics/claude-code/issues/22906) — Community confirmation (5+ users) - #404 — Same freeze, VSCode context (but actually universal)
xiaosongz commented 2026-02-04 14:53:45 +00:00 (Migrated from github.com)

Additional confirmation — freeze happens even when bash IS in PATH

Our environment has Git Bash properly installed and in PATH (bash 5.2.37, MSYS2), yet the same freeze occurs on Claude Code v2.1.30. So the problem has at least two triggers:

  1. Bash not in PATH (your case) — hook command fails immediately, but the error still freezes the CLI
  2. Bash in PATH but hook runs too slowly (our case / #404) — the session-start.sh script's escape_for_json function does character-by-character iteration in pure bash, which is extremely slow on Windows. This blocks the Ink TUI from entering raw mode for stdin.

In both cases, the result is the same: terminal is completely unresponsive.

Issue #404 reports the same freeze but attributes it to VSCode. It actually affects all Windows terminals — VSCode, Windows Terminal, Git Bash, PowerShell. I'd suggest these two issues be linked or merged, as they share the same root cause: the SessionStart hook running synchronously blocks the TUI.

Two-sided problem

We filed anthropics/claude-code#22934 for the Claude Code side — the core CLI should never freeze when a hook fails or runs slowly. But the plugin side also needs a fix:

  • Ship a cross-platform hook (Node.js instead of bash), or
  • Add "async": true to the hook definition by default (confirmed working in #404), or
  • Detect Windows and use a .cmd/.ps1 alternative

Workarounds

  1. Add async: true to the SessionStart hook in hooks/hooks.json (quick fix, confirmed in #404)
  2. Disable the plugin: "superpowers@claude-plugins-official": false in ~/.claude/settings.json
  3. Clean large session files: find ~/.claude/projects -name "*.jsonl" -size +10M -delete (reduces hang severity)
## Additional confirmation — freeze happens even when bash IS in PATH Our environment has Git Bash properly installed and in PATH (`bash 5.2.37, MSYS2`), yet the same freeze occurs on Claude Code v2.1.30. So the problem has at least two triggers: 1. **Bash not in PATH** (your case) — hook command fails immediately, but the error still freezes the CLI 2. **Bash in PATH but hook runs too slowly** (our case / #404) — the `session-start.sh` script's `escape_for_json` function does character-by-character iteration in pure bash, which is extremely slow on Windows. This blocks the Ink TUI from entering raw mode for stdin. In both cases, the result is the same: **terminal is completely unresponsive**. ### This is related to #404 Issue #404 reports the same freeze but attributes it to VSCode. It actually affects all Windows terminals — VSCode, Windows Terminal, Git Bash, PowerShell. I'd suggest these two issues be linked or merged, as they share the same root cause: the SessionStart hook running synchronously blocks the TUI. ### Two-sided problem We filed [anthropics/claude-code#22934](https://github.com/anthropics/claude-code/issues/22934) for the **Claude Code side** — the core CLI should never freeze when a hook fails or runs slowly. But the **plugin side** also needs a fix: - Ship a cross-platform hook (Node.js instead of bash), or - Add `"async": true` to the hook definition by default (confirmed working in #404), or - Detect Windows and use a `.cmd`/`.ps1` alternative ### Workarounds 1. **Add `async: true`** to the SessionStart hook in `hooks/hooks.json` (quick fix, confirmed in #404) 2. **Disable the plugin**: `"superpowers@claude-plugins-official": false` in `~/.claude/settings.json` 3. **Clean large session files**: `find ~/.claude/projects -name "*.jsonl" -size +10M -delete` (reduces hang severity) ### Related - [anthropics/claude-code#22934](https://github.com/anthropics/claude-code/issues/22934) — Detailed freeze regression report - [anthropics/claude-code#22906](https://github.com/anthropics/claude-code/issues/22906) — Community confirmation (5+ users) - #404 — Same freeze, VSCode context (but actually universal)
asfilion commented 2026-02-04 18:37:37 +00:00 (Migrated from github.com)

I can consistently reproduce this in directories with large amounts of files (~8GB data across hundreds of files in a subfolder). If I switch to an empty directory, everything works fine. Disabling the plugin restores functionality in the large directories.

I can consistently reproduce this in directories with large amounts of files (~8GB data across hundreds of files in a subfolder). If I switch to an empty directory, everything works fine. Disabling the plugin restores functionality in the large directories.
asfilion commented 2026-02-04 18:37:37 +00:00 (Migrated from github.com)

I can consistently reproduce this in directories with large amounts of files (~8GB data across hundreds of files in a subfolder). If I switch to an empty directory, everything works fine. Disabling the plugin restores functionality in the large directories.

I can consistently reproduce this in directories with large amounts of files (~8GB data across hundreds of files in a subfolder). If I switch to an empty directory, everything works fine. Disabling the plugin restores functionality in the large directories.
asfilion commented 2026-02-04 20:06:06 +00:00 (Migrated from github.com)

Can confirm adding async: true to the hook file as suggested in #404 also fixes my use case for large directories.

Can confirm adding `async: true` to the hook file as suggested in #404 also fixes my use case for large directories.
asfilion commented 2026-02-04 20:06:06 +00:00 (Migrated from github.com)

Can confirm adding async: true to the hook file as suggested in #404 also fixes my use case for large directories.

Can confirm adding `async: true` to the hook file as suggested in #404 also fixes my use case for large directories.
obra commented 2026-02-05 19:57:10 +00:00 (Migrated from github.com)

Partial fix update

The terminal freeze problem reported here has been fixed on main:

  • async: true (961052e): Hook failures no longer block the TUI, regardless of whether bash is found or not
  • O(n) escape_for_json (038abed): ~7x faster, fixes the "bash in PATH but too slow" variant

The path mangling variant (backslash stripping from CLAUDE_PLUGIN_ROOT) is tracked at #420 (upstream at anthropics/claude-code#23204).

Still open here: The "bash not in PATH" problem is a distinct issue — when Windows doesn't have bash available for hook execution, the hook silently fails (now without freezing, thanks to async). This requires either a cross-platform hook approach or upstream CC changes.

## Partial fix update The **terminal freeze** problem reported here has been fixed on main: - **`async: true`** (`961052e`): Hook failures no longer block the TUI, regardless of whether bash is found or not - **O(n) `escape_for_json`** (`038abed`): ~7x faster, fixes the "bash in PATH but too slow" variant The **path mangling** variant (backslash stripping from CLAUDE_PLUGIN_ROOT) is tracked at **#420** (upstream at anthropics/claude-code#23204). **Still open here:** The "bash not in PATH" problem is a distinct issue — when Windows doesn't have bash available for hook execution, the hook silently fails (now without freezing, thanks to async). This requires either a cross-platform hook approach or upstream CC changes.
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#414
No description provided.