[BUG] Platform reported as "darwin" / Shell "zsh" under Git Bash (MSYS) on Windows 11
Summary
When running Claude Code inside Git Bash / MSYS on Windows 11, the environment block injected into the session reports Platform: darwin and Shell: zsh. The machine is Windows 11 with no macOS whatsoever. This causes the model to mis-judge the environment (e.g. assuming macOS paths/shell, or that D:\ drives are inaccessible), leading it to use wrong path conventions and refuse valid operations.
Environment
- OS: Windows 11 (build 26200)
- Shell: Git Bash / MSYS (MINGW64)
- Claude Code version: 2.1.170
- Node: v24.12.0
Real environment values (from the shell Claude Code itself runs in):
$ uname -a
MINGW64_NT-10.0-26200 Maxwell-OMEN 3.6.6-1cdd4371.x86_64 2026-01-15 22:20 UTC x86_64 Msys
$ echo $OSTYPE
msys
$ echo $MSYSTEM
MINGW64
Actual behavior
The session environment block contains:
Platform: darwin
Shell: zsh
These are macOS defaults. darwin + zsh appear together as a set, which strongly suggests the platform-detection logic fails to recognize the MSYS/MINGW environment and falls back to hard-coded macOS default values.
Expected behavior
On Git Bash / MSYS, Claude Code should detect the environment from uname -s (which contains MINGW64_NT / MSYS_NT) and/or $OSTYPE (msys) and $MSYSTEM (MINGW64), and report the platform as Windows (MSYS/MinGW) with the correct shell (bash), instead of falling back to darwin / zsh.
Impact
Because the injected environment block claims macOS, the model:
- assumes macOS-style paths and shell semantics;
- can wrongly conclude Windows drives (e.g.
D:\) are inaccessible, when in fact they are reachable via/c/,/d/under MSYS; - adopts incorrect path conventions (
D:\...vs/d/...).
This is closely related to #9883 (MSYS environment not recognized, cygpath handling), but the specific symptom here is the platform/shell metadata being reported as darwin/zsh, which I could not find reported elsewhere.
Suggested fix
Detect MSYS/MinGW via uname -s (MSYS_NT / MINGW64_NT / MINGW32_NT) or $OSTYPE=msys / $MSYSTEM, and populate the environment block with the correct Windows-under-MSYS platform and bash shell, instead of the macOS fallback.
5 Comments
你是不是用的中转站?
是的,我使用了第三方 API 中转服务。看来可能是中转站导致的环境信息异常,我会再使用官方 API 复现测试。
----------Reply to Message----------
On Thu, Jul 16, 2026 14:58 PM @.***> wrote:
shynur left a comment (anthropics/claude-code#67231)
你是不是用的中转站?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: @.***>
我用的 aicodemirror 那个中转站 (这种中转站也可能只是中转了别的中转站, 就是个辣鸡中介). 你要是有官方 API 测试结果就请麻烦贴一下参考一下
我用的是freemodel
----------Reply to Message----------
On Thu, Jul 16, 2026 15:05 PM @.***> wrote:
shynur left a comment (anthropics/claude-code#67231)
我用的 aicodemirror 那个中转站. 你要是有官方 API 测试结果就请麻烦贴一下参考一下
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: @.***>
@Maxwell389 有结果没