[Bug] EINVAL on Windows: Bash commands fail - cannot open task output file
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
- Open any directory on Windows
- Run
claude - Try any Bash command (even
echo test) - 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
- Open any directory on Windows
- Run
claude - Try any Bash command (even
echo test) - EINVAL error every time
Error Messages/Logs
Steps to Reproduce
- Install Claude Code 2.1.53 on Windows (native installer)
- Open PowerShell
- cd to any directory (e.g.,
mkdir C:\test-claude && cd C:\test-claude) - Run
claude - Type any command that triggers Bash, e.g.,
echo test - 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_
20 Comments
Im getting same error
Same issue - everyone at my company is getting same all of a sudden.
Both 2.1.50l & 2.1.53
Same error, v2.1.53
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)
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
yep same here :/ macbook working fine at least
same issues
Downgrade to 2.1.52 works
Same on 2.1.50 locally on Windows. My 2.1.53 in docker are fine.
I am also getting same error
I'm getting the same error message on 2.1.53 unfortunately.
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.52You'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.
Downgrading to 2.1.52 solved the issues on my end as well
Still reproducible on v2.1.56 — workaround found
Environment:
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
SHELLenvironment variable. VS Code setsSHELL=/bin/bash.exeautomatically. 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):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.openSyncEINVAL issue. When SHELL is unset, Claude Code falls back to a code path that constructs the output file path in a way that Bun'sfs.openSyncrejects on Windows.Piling on a big me too.
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
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.
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.