[BUG] [Windows] Cowork crashes: HostLoop forces CLAUDE_CODE_GIT_BASH_PATH=%COMSPEC% (cmd.exe), overriding env/PATH/settings

Resolved 💬 1 comment Opened Jun 5, 2026 by phuquy182 Closed Jul 10, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] 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).

  1. Added C:\Program Files\Git\bin to PATH — where bash resolves to the correct bash.exe.
  2. Full Windows reboot.
  3. env block in C:\ProgramData\ClaudeCode\managed-settings.json (enterprise, highest precedence) and ~/.claude/settings.json:

``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_

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗