[BUG] GitHub Issue: Bash tool EINVAL on Windows
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?
GitHub Issue: Bash tool EINVAL on Windows
Title
Bash tool fails with EINVAL on Windows 11 (all commands, non-ASCII username)
Body
Bug report
Environment:
- OS: Windows 11 Pro 10.0.26200
- Claude Code version: 2.1.53 (also tested after
npm update -g) - Shell: Git Bash (MSYS2)
- Node.js: v22.18.0
- Username: Contains Japanese characters (
XX拓人)
Description
Every Bash tool invocation fails with EINVAL: invalid argument when trying to open the output file. This affects all commands — even echo test. Other tools (Read, Write, Edit, Glob, Grep, MCP tools) work perfectly fine.
Error message
Error: EINVAL: invalid argument, open 'C:\Users\XX拓人\AppData\Local\Temp\claude\C---TokiumLocalWork\tasks\bdge56opr.output'
The task output path pattern is:
C:\Users\{username}\AppData\Local\Temp\claude\{workspace-slug}\tasks\{random-id}.output
Reproduction steps
- On Windows 11 with a non-ASCII (Japanese) username
- Open Claude Code in any working directory
- Run any Bash command (e.g.,
echo test) - → EINVAL error on the
.outputfile
What I've tried
| Attempt | Result |
|---------|--------|
| Changed TEMP/TMP to C:\Temp (ASCII-only path) | Same EINVAL — output path became C:\Temp\claude\C--Users-----\tasks\... but still failed |
| Different commands (echo, ls, pwd, git status) | All fail with same error |
| npm update -g @anthropic-ai/claude-code | Updated (2 packages changed), but same session still fails. Haven't restarted yet |
What still works
Readtool — reads files normally (including PDFs, images)Write/Edittools — creates and edits files normallyGlob/Greptools — file search works- MCP tools (Linear, JIRA, Notion, Slack, Playwright) — all work
- Only
Bashtool is broken
Analysis
The error occurs at Node.js fs.open() on the output file path. Since changing TEMP to an ASCII-clean path didn't help, the non-ASCII username in the path is likely not the direct cause — it seems to be a deeper issue with how the Bash tool creates its output files on Windows.
Possibly related issues
- #21915 — Windows: 0-byte output files from Bash tool (same
tasks/path pattern) - #26545 — Git Bash exit code 1 with no output (v2.1.45+)
- #26505 — WSL bash + Git Bash coexistence issues
What Should Happen?
Expected behavior
Bash tool should execute commands and return output on Windows, as it did in earlier versions.
Error Messages/Logs
Steps to Reproduce
Reproduction steps
- On Windows 11 with a non-ASCII (Japanese) username
- Open Claude Code in any working directory
- Run any Bash command (e.g.,
echo test) - → EINVAL error on the
.outputfile
What I've tried
| Attempt | Result |
|---------|--------|
| Changed TEMP/TMP to C:\Temp (ASCII-only path) | Same EINVAL — output path became C:\Temp\claude\C--Users-----\tasks\... but still failed |
| Different commands (echo, ls, pwd, git status) | All fail with same error |
| npm update -g @anthropic-ai/claude-code | Updated (2 packages changed), but same session still fails. Haven't restarted yet |
Claude Model
None
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.53
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
_No response_
16 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
Mesmo problema aqui com a versão 2.1.53
+1, Probably some bug introduced in 2.1.53 - because approximately it is not working for me for 1h (as the release timing). But I could be wrong. Let me check. Hmm.. Yes, downgrading to "npm install -g @anthropic-ai/claude-code@2.1.52" solves it.
confirmed, downgrade to 2.1.52 and im working again. although its trying to auto update it again, had to smack that down. set "autoUpdatesChannel": "stable" in settings.json, hopefully that does it. EDIT see comment immediately below from @paq for full disable setting
Anthropic please stop shipping broken builds. if only there was a tool that could assist in creating automated tests
I've encountered the same issue.
Downgrading to 2.1.52 resolved the problem perfectly.
I also added the following to prevent auto-updates in
%USERPROFILE%\.claude\settings.json:It works fine now.
Hit this too on 2.1.53. Downloaded claude-2.1.52-win32-x64.exe, and ran
claude-2.1.52-win32-x64.exe install --force 2.1.52+1
Had this too. I downgraded to 2.1.52 .
having this issue. need to downgrade for now I guess
Workaround:
CLAUDE_CODE_GIT_BASH_PATHenvironment variableSetting the
CLAUDE_CODE_GIT_BASH_PATHenvironment variable to the explicit Git Bash path resolved this issue for me without downgrading.Environment
Fix (PowerShell)
After setting this, restart Claude Code.
echo helloand all other Bash tool commands work normally.Root cause hypothesis
Claude Code's auto-detection of the MSYS bash path seems to produce an incompatible path for
fs.open()when creating.outputfiles in the temp directory. Explicitly specifying the Git Bash binary path bypasses this detection issue.What I tried before (all failed)
%TEMP%\claudedirectorytasks/subdirectoryHope this helps others avoid the downgrade!
moved to the npm install instead as a work around, wasted a lot of time troubleshooting this.
Hi, thanks for reporting. We just released v2.1.55 which should fix this.
Confirmed, thanks for the fast turn around!
Fixed 2.1.55
Error still happened for me on 2.1.56 (bun). Setting
$env:CLAUDE_CODE_GIT_BASH_PATHto git bash still fixes it without downgrade.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.