[BUG] Bash tool EINVAL on Windows persists in v2.1.53 — stdio fd regression from v2.1.45 not fully fixed
Bug Description
Bash tool fails with EINVAL: invalid argument on every command in Claude Code v2.1.53 on Windows with Git Bash (Scoop install). This appears to be a continuation/variant of the stdio fd regression introduced in v2.1.45 (#26413, #26462, #26545).
Those issues were closed as completed, but the problem persists on v2.1.53 with a different error signature: EINVAL instead of Bad file descriptor.
Error
EINVAL: invalid argument, open 'C:\Users\94049\AppData\Local\Temp\claude\C--Users-94049-Documents-Projects-Topo\tasks\b8miv62u5.output'
Every Bash tool call fails immediately with this error. The failure is in Node.js fs.open() on the task output file, before bash is even spawned.
Environment
- Claude Code: 2.1.53 (native install)
- OS: Windows 11 (MSYS_NT-10.0-26200 3.6.6)
- Git: 2.53.0 (installed via Scoop)
- Bash path:
C:\Users\94049\scoop\apps\git\current\usr\bin\bash.exe - CLAUDE_CODE_GIT_BASH_PATH: set and valid
Verified
| Check | Result |
|-------|--------|
| bash -c "echo hello" from PowerShell | Works |
| Bash writes to the same temp directory from PowerShell | Works |
| Claude Code Write tool creates files in the same directory | Works |
| Claude Code Read/Glob/Grep tools | All work |
| dangerouslyDisableSandbox: true on Bash tool | Still EINVAL |
| Environment variables (GIT_INSTALL_ROOT, MSYS2_PATH_TYPE, TEMP) | All correct |
| After full computer restart + temp directory cleanup | Still EINVAL |
Root Cause (likely)
The v2.1.45 change from pipe-based stdio to file-descriptor-based stdio (fs.openSync(path, 'a')) for shell output capture is incompatible with MSYS2/Git Bash on Windows. The fix applied after #26413 appears incomplete — the openSync() call itself now fails with EINVAL rather than succeeding but producing an invalid fd for bash.
Related Issues
- #26413 — Original report: Bad file descriptor on stdout pipe
- #26462 — Bash broken on Windows in v2.1.45
- #26545 — Bash tool returns exit code 1 with no output since v2.1.45
8 Comments
Found 2 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
Can confirm this issue. Additional data point:
This means the regression was re-introduced specifically in v2.1.53. Whatever fix was in place as of v2.1.52 was broken again in v2.1.53.
Environment:
C:\Users\ko\DesktopOMFG DID YOU REALLY JUST FINALLY FIX THE BUN ISSUE AND BREAK EVERYTHING ELSE WITH THIS?
FFS, SORT YOURSELVES OUT
### Additional reproduction: Windows 11 / MSYS2 Git Bash
Environment:
Error (identical to OP):
Error: EINVAL: invalid argument, open 'C:\Users\NAME\AppData\Local\Temp\claude\C--Users-NAME\tasks\b80a8nnxs.output'
Confirmed behavior:
echo testContext: This user has 25 reproductions of the Bun crash bug (#21576) over 29 days. v2.1.53 shipped 4 Windows crash fixes that we were testing — but now the Bash tool is completely broken so we can't
test anything. Claude Code literally cannot file this bug report because it cannot run
ghcommands.The v2.1.53 changelog note "BashTool now skips login shell (-l flag) by default when a shell snapshot is available" is the likely culprit for re-introducing the fd regression from v2.1.45.
Downgrade to v2.1.52 confirmed as workaround by other reporters.
If you Google how to downgrade a native (not NPM) installation of Claude there's a bunch of outdated information. It's as simple as:
And turning off the autoupdater in your .claude/ settings JSON.
Environment:
Error:
EINVAL: invalid argument, open 'C:\Users\<user>\AppData\Local\Temp\claude\C--Users-<user>-git-<project>\tasks\<id>.output'
What I tried (none of these helped):
What fixed it:
npm install -g @anthropic-ai/claude-code@2.1.52
Downgrade to v2.1.52 immediately resolved the issue. All other tools (Read, Write, Edit, Glob, Grep) worked fine on v2.1.53 — only the Bash tool
was broken.
Additional note: where.exe bash returns 3 results in this order:
Even with CLAUDE_CODE_GIT_BASH_PATH explicitly set, v2.1.53 still fails with EINVAL before bash is even spawned.
Confirming on v2.1.53 native (WinGet install), Windows 11 Pro 10.0.26200
Environment:
C:\Program Files\Git\bin\bash.exe)G:\My Drive\...) — but also reproduces fromC:\Users\aaronError:
Confirmed:
C:\Users\paths (not a cloud storage filter driver issue)Writetool can create.outputfiles in the exact sametasks/directory — so it's not a permissions or directory issuedangerouslyDisableSandbox: truedoes not help%TEMP%\claude\+ full restart does not helpThis is a regression between v2.1.52 → v2.1.53 in the native binary's
fs.openSync()call for task output files.Hi, thanks for reporting. We just released v2.1.55 which should fix this.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.