[Bug] EINVAL on Windows: Bash commands fail - cannot open task output file

Resolved 💬 20 comments Opened Feb 25, 2026 by hammaa Closed Apr 18, 2026
💡 Likely answer: A maintainer (ashwin-ant, collaborator) responded on this thread — see the highlighted reply below.

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?

Description

All Bash commands fail with EINVAL error on Windows. Even echo test fails.
This was working last night, broken this morning without any changes on my end.

Error

Error: EINVAL: invalid argument, open 'C:\Users\hamma\AppData\Local\Temp\claude\C--Users-hamma-git-whatap-go-sdk\tasks\bwtfhc68s.output'

Key findings

  • Happens in ALL directories, not project-specific
  • Manually creating files in that path works fine (New-Item succeeds)
  • OS permissions are normal
  • No Windows Defender blocks
  • Disk space sufficient (107GB free)
  • No Windows updates since Feb 11

Environment

  • Claude Code version: 2.1.53
  • OS: Windows 10 (Build 26100.7840)
  • Shell: PowerShell

Steps to reproduce

  1. Open any directory on Windows
  2. Run claude
  3. Try any Bash command (even echo test)
  4. EINVAL error every time

What Should Happen?

Description

All Bash commands fail with EINVAL error on Windows. Even echo test fails.
This was working last night, broken this morning without any changes on my end.

Error

Error: EINVAL: invalid argument, open 'C:\Users\hamma\AppData\Local\Temp\claude\C--Users-hamma-git-whatap-go-sdk\tasks\bwtfhc68s.output'

Key findings

  • Happens in ALL directories, not project-specific
  • Manually creating files in that path works fine (New-Item succeeds)
  • OS permissions are normal
  • No Windows Defender blocks
  • Disk space sufficient (107GB free)
  • No Windows updates since Feb 11

Environment

  • Claude Code version: 2.1.53
  • OS: Windows 10 (Build 26100.7840)
  • Shell: PowerShell

Steps to reproduce

  1. Open any directory on Windows
  2. Run claude
  3. Try any Bash command (even echo test)
  4. EINVAL error every time

Error Messages/Logs

Steps to Reproduce

  1. Install Claude Code 2.1.53 on Windows (native installer)
  2. Open PowerShell
  3. cd to any directory (e.g., mkdir C:\test-claude && cd C:\test-claude)
  4. Run claude
  5. Type any command that triggers Bash, e.g., echo test
  6. Error occurs:

Error: EINVAL: invalid argument, open 'C:\Users\<user>\AppData\Local\Temp\claude\C--test-claude\tasks\<id>.output'

No specific files or code needed - happens with any Bash command in any directory.

Verified manually that file creation in the same temp path works:
New-Item "C:\Users\hamma\AppData\Local\Temp\claude\C--test-claude\tasks\test.txt" -Force -Value "test"

succeeds without error

The issue appears to be in how Claude Code internally opens the .output file, not an OS-level permission or path problem.

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.1.53

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

_No response_

View original on GitHub ↗

20 Comments

Boysiee · 4 months ago

Im getting same error

davidames · 4 months ago

Same issue - everyone at my company is getting same all of a sudden.

Both 2.1.50l & 2.1.53

vSeamar · 4 months ago

Same error, v2.1.53

webbertakken · 4 months ago

Same here, none of the solutions it's suggesting have worked.
Entire folder deleted and recreated does not fix it either.

2.1.53 (Claude Code)

github-actions[bot] · 4 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/28333
  2. https://github.com/anthropics/claude-code/issues/28343
  3. https://github.com/anthropics/claude-code/issues/28357

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

ryan-day-ctr · 4 months ago

yep same here :/ macbook working fine at least

mdrathik · 4 months ago

same issues

webbertakken · 4 months ago

Downgrade to 2.1.52 works

claude install 2.1.52
anton-prepared · 4 months ago

Same on 2.1.50 locally on Windows. My 2.1.53 in docker are fine.

tommylee1115 · 4 months ago

I am also getting same error

jgonxo · 4 months ago

I'm getting the same error message on 2.1.53 unfortunately.

Nico-VanHaaster · 4 months ago

Same issue here Downgrading to 2.1.52 solved the issues.

Windows 11 Enterprise - Native Installtion

apivzero · 4 months ago
Same issue here Downgrading to 2.1.52 solved the issues. Windows 11 Enterprise - Native Installtion

npm install -g @anthropic-ai/claude-code@2.1.52

You'll need to ensure your path is pulling the right one, but otherwise it works.

Nico-VanHaaster · 4 months ago
npm install -g @anthropic-ai/claude-code@2.1.52 You'll need to ensure your path is pulling the right one, but otherwise it works.

I have run "claude install 2.1.52" then added

"env": {
"DISABLE_AUTOUPDATER": "1"
},
To my claude settings.json file temporarily.

jgonxo · 4 months ago

Downgrading to 2.1.52 solved the issues on my end as well

GBA63 · 4 months ago

Still reproducible on v2.1.56 — workaround found

Environment:

  • Claude Code v2.1.56 (native install)
  • Windows 11 Pro Build 26200
  • Git Bash (C:\Program Files\Git\bin\bash.exe)

Finding: The v2.1.55 fix is incomplete. The EINVAL bug persists on v2.1.56 when Claude Code is launched from a standalone PowerShell 7 terminal. The same version launched from VS Code's integrated terminal works fine.

Root cause identified: The difference is the SHELL environment variable. VS Code sets SHELL=/bin/bash.exe automatically. A standalone PowerShell terminal does not. When SHELL is unset, Claude Code takes a different code path for Bash tool file operations that triggers the EINVAL.

Verified with controlled tests (same machine, same version, same project):

| Test | SHELL set? | TEMP changed? | Bash tool works? |
|------|-----------|---------------|-----------------|
| VS Code terminal | Yes (auto) | No | Yes |
| PS7, no changes | No | No | No — EINVAL |
| PS7, only SHELL set | Yes (manual) | No | Yes |
| PS7, only TEMP set to /tmp | No | Yes | No — still broken |

Workaround: Add this to your PowerShell profile ($PROFILE):

$env:SHELL = "C:\Program Files\Git\bin\bash.exe"

This is a permanent fix that survives restarts. No need to downgrade to v2.1.52.

Implication for Anthropic: The v2.1.55 fix likely patched one code path but the SHELL-detection branch still has the Bun fs.openSync EINVAL issue. When SHELL is unset, Claude Code falls back to a code path that constructs the output file path in a way that Bun's fs.openSync rejects on Windows.

jselbie · 4 months ago

Piling on a big me too.

ilaikim99 · 4 months ago

Claude Code v2.1.53 on Windows failing with 'EINVAL: invalid argument' on every bash command? The root cause is the SHELL environment variable not being set in standalone PowerShell terminals — there's a one-line fix for your PowerShell profile: https://cacheoverflow.dev/blog/eTVZ734l

ashwin-ant collaborator · 2 months ago

This was fixed in v2.1.59 — The Bash tool on Windows no longer fails with EINVAL on every command. If you're still seeing this in the latest version, please comment with your version and repro and we'll reopen.

github-actions[bot] · 2 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.