[BUG] Bash tool EINVAL on Windows persists in v2.1.53 — stdio fd regression from v2.1.45 not fully fixed

Status Fixed / completed
Reported on v2.1.53
Maintainer reply None cached
Activity 8 comments · opened Feb 25, 2026 · closed Feb 25, 2026

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

View original on GitHub ↗

8 Comments

github-actions[bot] · 6 months ago

Found 2 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/28333
  2. https://github.com/anthropics/claude-code/issues/28342

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

ree9622 · 6 months ago

Can confirm this issue. Additional data point:

  • v2.1.52: Bash tool works fine
  • v2.1.53: Bash tool completely broken with the same EINVAL error

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:

  • Windows 11 (Build 26200, MSYS_NT-10.0-26200)
  • Working directory: C:\Users\ko\Desktop
  • Downgrading to v2.1.52 resolves the issue immediately with no other changes needed.
ThatDragonOverThere · 6 months ago

OMFG 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:

  • Claude Code: v2.1.53
  • OS: Windows 11 (MSYS_NT-10.0-26200 3.5.4-395fda67.x86_64)
  • Shell: MSYS2/Git Bash
  • Working directory: C:\Users\Cassie

Error (identical to OP):
Error: EINVAL: invalid argument, open 'C:\Users\NAME\AppData\Local\Temp\claude\C--Users-NAME\tasks\b80a8nnxs.output'

Confirmed behavior:

  • Every single Bash tool call fails with EINVAL — even echo test
  • All other tools work fine (Read, Write, Edit, Glob, Grep, WebSearch, WebFetch)
  • This is happening across ALL sessions, not intermittent
  • Started immediately after auto-update to v2.1.53

Context: 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 gh commands.

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.

taspeotis · 6 months ago

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:

claude install 2.1.52

And turning off the autoupdater in your .claude/ settings JSON.

patajones · 6 months ago

Environment:

  • Claude Code: v2.1.53 (npm install)
  • OS: Windows 11 Home (10.0.26200.7840)
  • Shell: Git Bash (C:\Program Files\Git\bin\bash.exe)
  • Note: WSL bash (C:\Windows\System32\bash.exe) is also in PATH before Git Bash

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):

  • Setting CLAUDE_CODE_GIT_BASH_PATH in ~/.claude/settings.json to force Git Bash
  • Deleting and recreating the temp directory (%TEMP%\claude\...)
  • Restarting Claude Code and the computer
  • Verified the temp directory is writable from CMD (echo test > ...tasks\test.output works fine)
  • Confirmed no OneDrive sync on the temp directory

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:

  1. C:\Windows\System32\bash.exe (WSL)
  2. C:\Users\<user>\AppData\Local\Microsoft\WindowsApps\bash.exe (WSL)
  3. C:\Program Files\Git\bin\bash.exe (Git Bash)

Even with CLAUDE_CODE_GIT_BASH_PATH explicitly set, v2.1.53 still fails with EINVAL before bash is even spawned.

AaronHallAttorney · 6 months ago

Confirming on v2.1.53 native (WinGet install), Windows 11 Pro 10.0.26200

Environment:

  • Claude Code v2.1.53 (native install via WinGet)
  • Windows 11 Pro Build 26200
  • Git Bash (standard Git for Windows, C:\Program Files\Git\bin\bash.exe)
  • Working directory: Google Drive (G:\My Drive\...) — but also reproduces from C:\Users\aaron

Error:

Error: EINVAL: invalid argument, open 'C:\Users\aaron\AppData\Local\Temp\claude\G--My-Drive-cc-aaron\tasks\bl0zhoaci.output'

Confirmed:

  • Reproduces from both Google Drive paths and local C:\Users\ paths (not a cloud storage filter driver issue)
  • Read, Write, Edit, Glob, Grep, Task (subagents), MCP tools all work fine — only Bash is broken
  • Write tool can create .output files in the exact same tasks/ directory — so it's not a permissions or directory issue
  • dangerouslyDisableSandbox: true does not help
  • Clearing %TEMP%\claude\ + full restart does not help
  • Bash subagents (Task tool) hit the same EINVAL since they share the temp path

This is a regression between v2.1.52 → v2.1.53 in the native binary's fs.openSync() call for task output files.

shawnm-anthropic · 6 months ago

Hi, thanks for reporting. We just released v2.1.55 which should fix this.

github-actions[bot] · 5 months ago

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.