claude-code - 💡(How to fix) Fix [BUG] [Windows] Cowork crashes: HostLoop forces CLAUDE_CODE_GIT_BASH_PATH=%COMSPEC% (cmd.exe), overriding env/PATH/settings

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

On Windows, every Cowork session crashes with the UI banner "Claude Code crashed." The Cowork HostLoop spawns the Windows claude.exe with CLAUDE_CODE_GIT_BASH_PATH set to %COMSPEC% (C:\WINDOWS\system32\cmd.exe) instead of detecting Git Bash or honoring my configuration. The CLI rejects cmd.exe and exits with code 1.

Error Message

2026-06-05 09:30:08 [warn] [HostLoop] cli.js stderr: Claude Code was unable to find CLAUDE_CODE_GIT_BASH_PATH path "C:\WINDOWS\system32\cmd.exe" 2026-06-05 09:30:08 [error] Session local_... query error: Claude Code process exited with code 1 at SAr.getProcessExitError (app.asar/.vite/build/index.js:466:8374)

Root Cause

On Windows, every Cowork session crashes with the UI banner "Claude Code crashed." The Cowork HostLoop spawns the Windows claude.exe with CLAUDE_CODE_GIT_BASH_PATH set to %COMSPEC% (C:\WINDOWS\system32\cmd.exe) instead of detecting Git Bash or honoring my configuration. The CLI rejects cmd.exe and exits with code 1.

Fix Action

Fix / Workaround

Workarounds tried (all verified loaded — none fix it)

  1. User env var CLAUDE_CODE_GIT_BASH_PATH = C:\Program Files\Git\bin\bash.exe — confirmed present in the app process ($env:CLAUDE_CODE_GIT_BASH_PATH reads bash.exe in app child processes).
  2. Added C:\Program Files\Git\bin to PATH — where bash resolves to the correct bash.exe.
  3. Full Windows reboot.
  4. env block in C:\ProgramData\ClaudeCode\managed-settings.json (enterprise, highest precedence) and ~/.claude/settings.json:
    { "env": { "CLAUDE_CODE_GIT_BASH_PATH": "C:\\Program Files\\Git\\bin\\bash.exe" } }

Code Example



---

2026-06-05 09:30:08 [warn] [HostLoop] cli.js stderr: Claude Code was unable to find CLAUDE_CODE_GIT_BASH_PATH path "C:\WINDOWS\system32\cmd.exe"
2026-06-05 09:30:08 [error] Session local_... query error: Claude Code process exited with code 1
    at SAr.getProcessExitError (app.asar/.vite/build/index.js:466:8374)

---

{ "env": { "CLAUDE_CODE_GIT_BASH_PATH": "C:\\Program Files\\Git\\bin\\bash.exe" } }
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

Can not use Corwork

What Should Happen?

Always recived

Claude Code crashed Try sending your message again. If it keeps happening, share feedback so we can investigate.

You can restart the conversation from an earlier message.

Error Messages/Logs

Steps to Reproduce

Summary

On Windows, every Cowork session crashes with the UI banner "Claude Code crashed." The Cowork HostLoop spawns the Windows claude.exe with CLAUDE_CODE_GIT_BASH_PATH set to %COMSPEC% (C:\WINDOWS\system32\cmd.exe) instead of detecting Git Bash or honoring my configuration. The CLI rejects cmd.exe and exits with code 1.

Environment

  • Claude Desktop: 1.11187.1
  • Claude Code (CCD): 2.1.161
  • OS: Windows x64
  • Git for Windows installed at C:\Program Files\Git (C:\Program Files\Git\bin\bash.exe exists)

Log excerpt (%APPDATA%\Claude\logs\main.log)

2026-06-05 09:30:08 [warn] [HostLoop] cli.js stderr: Claude Code was unable to find CLAUDE_CODE_GIT_BASH_PATH path "C:\WINDOWS\system32\cmd.exe"
2026-06-05 09:30:08 [error] Session local_... query error: Claude Code process exited with code 1
    at SAr.getProcessExitError (app.asar/.vite/build/index.js:466:8374)

The forwarded value is always exactly %COMSPEC%, regardless of configuration.

Workarounds tried (all verified loaded — none fix it)

  1. User env var CLAUDE_CODE_GIT_BASH_PATH = C:\Program Files\Git\bin\bash.exe — confirmed present in the app process ($env:CLAUDE_CODE_GIT_BASH_PATH reads bash.exe in app child processes).
  2. Added C:\Program Files\Git\bin to PATH — where bash resolves to the correct bash.exe.
  3. Full Windows reboot.
  4. env block in C:\ProgramData\ClaudeCode\managed-settings.json (enterprise, highest precedence) and ~/.claude/settings.json:
    { "env": { "CLAUDE_CODE_GIT_BASH_PATH": "C:\\Program Files\\Git\\bin\\bash.exe" } }

In all cases the HostLoop still forwards cmd.exe.

Steps to reproduce

  1. Windows x64 with Git for Windows installed.
  2. Open Claude Desktop → start a Cowork session.
  3. Send any message → "Claude Code crashed" (CLI exits code 1; log shows the cmd.exe line above).

Expected behavior

The Cowork HostLoop should set CLAUDE_CODE_GIT_BASH_PATH to the detected Git Bash (...\Git\bin\bash.exe) or honor the existing env var / settings.json env, and must not fall back to %COMSPEC% (cmd.exe), which the CLI explicitly rejects.

Notes

Unrelated non-blocking log noise: a stale secondary org returns 403 "Organization has status: canceled"; the app auto-switches to the valid org and initialization succeeds. Network connectivity is fine. Neither is the cause.

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

No response

Claude Code Version

2.1.161

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

No response

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

The Cowork HostLoop should set CLAUDE_CODE_GIT_BASH_PATH to the detected Git Bash (...\Git\bin\bash.exe) or honor the existing env var / settings.json env, and must not fall back to %COMSPEC% (cmd.exe), which the CLI explicitly rejects.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING