[BUG] GitHub Issue: Bash tool EINVAL on Windows

Resolved 💬 16 comments Opened Feb 25, 2026 by TakutoAshida Closed Feb 25, 2026

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

  1. On Windows 11 with a non-ASCII (Japanese) username
  2. Open Claude Code in any working directory
  3. Run any Bash command (e.g., echo test)
  4. → EINVAL error on the .output file

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

  • Read tool — reads files normally (including PDFs, images)
  • Write / Edit tools — creates and edits files normally
  • Glob / Grep tools — file search works
  • MCP tools (Linear, JIRA, Notion, Slack, Playwright) — all work
  • Only Bash tool 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

  1. On Windows 11 with a non-ASCII (Japanese) username
  2. Open Claude Code in any working directory
  3. Run any Bash command (e.g., echo test)
  4. → EINVAL error on the .output file

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_

View original on GitHub ↗

16 Comments

github-actions[bot] · 4 months ago

Found 3 possible duplicate issues:

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

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

HerbertLins · 4 months ago

Mesmo problema aqui com a versão 2.1.53

pumanitro · 4 months ago

+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.

cwilliams5 · 4 months ago
+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

paq · 4 months ago

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:

{
  "env": {
    "DISABLE_AUTOUPDATER": "1"
  }
}

It works fine now.

kfrancis · 4 months ago

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

yzluoes · 4 months ago

+1

Lorenzras · 4 months ago

Had this too. I downgraded to 2.1.52 .

tasid · 4 months ago

having this issue. need to downgrade for now I guess

ahnbu · 4 months ago

Workaround: CLAUDE_CODE_GIT_BASH_PATH environment variable

Setting the CLAUDE_CODE_GIT_BASH_PATH environment variable to the explicit Git Bash path resolved this issue for me without downgrading.

Environment

  • Claude Code: v2.1.53 → v2.1.55 (both affected, both fixed with this workaround)
  • OS: Windows 10 (MSYS_NT-10.0-26200)
  • Shell: MSYS2/Git Bash
  • Install: Standalone binary (not npm)

Fix (PowerShell)

# Temporary (current session only)
$env:CLAUDE_CODE_GIT_BASH_PATH = "C:\Program Files\git\bin\bash.exe"

# Permanent (user environment variable)
[Environment]::SetEnvironmentVariable("CLAUDE_CODE_GIT_BASH_PATH", "C:\Program Files\git\bin\bash.exe", "User")

After setting this, restart Claude Code. echo hello and 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 .output files in the temp directory. Explicitly specifying the Git Bash binary path bypasses this detection issue.

What I tried before (all failed)

  1. Deleting %TEMP%\claude directory
  2. Manually creating tasks/ subdirectory
  3. Verifying filesystem permissions (no issues)
  4. Full restart of Claude Code
  5. Stopping Google Drive sync

Hope this helps others avoid the downgrade!

tomtokitajr · 4 months ago

moved to the npm install instead as a work around, wasted a lot of time troubleshooting this.

shawnm-anthropic · 4 months ago

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

cwilliams5 · 4 months ago
Hi, thanks for reporting. We just released v2.1.55 which should fix this.

Confirmed, thanks for the fast turn around!

logey999 · 4 months ago

Fixed 2.1.55

sebastienvercammen · 4 months ago

Error still happened for me on 2.1.56 (bun). Setting $env:CLAUDE_CODE_GIT_BASH_PATH to git bash still fixes it without downgrade.

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