claude-code - 💡(How to fix) Fix Every Bash tool call fails on Windows with claude-XXXX-cwd: No such file or directory [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#49143Fetched 2026-04-17 08:49:41
View on GitHub
Comments
1
Participants
2
Timeline
7
Reactions
0
Timeline (top)
labeled ×4cross-referenced ×2commented ×1

Error Message

Error Messages/Logs

[DEBUG] Bash tool error (828ms): Shell command failed

Root Cause

On Windows, every Bash tool call exits 1 because the shell wrapper's epilogue references a CWD-persist file ($TEMP/claude-XXXX-cwd) that the wrapper never creates. The wrapped command itself runs — its output reaches stderr — but the CLI reports the tool call as failed. This also breaks any slash command that uses ! shell-eval in its markdown frontmatter (e.g. /commit-message), which aborts before the model turn starts because the ! command's exit code is non-zero.

Code Example

Exit code 1
  test
  /cygdrive/q/Projects/bks.ges.services
  /usr/bin/bash: line 1: /c/Users/OLEGSL~1/AppData/Local/Temp/claude-99a2-cwd: No such file or directory

  Relevant debug log lines appearing for every Bash call:

  [DEBUG] Session environment not yet supported on Windows
  [DEBUG] Spawning shell without login (-l flag skipped)
  [DEBUG] Bash tool error (828ms): Shell command failed
  [DEBUG] Permission suggestions for Bash: [... "//c/Users/Xxxx~1/AppData/Local/Temp//**" ...]
  [DEBUG] Permission suggestions for Bash: [... "//c/Users/XxxYyyy/AppData/Local/Temp//**" ...]

  Note the path-casing inconsistency — short name Xxxx~1 in some suggestions, long name XxxYyyy in others, within
   the same session.
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

On Windows, every Bash tool call exits 1 because the shell wrapper's epilogue references a CWD-persist file ($TEMP/claude-XXXX-cwd) that the wrapper never creates. The wrapped command itself runs — its output reaches stderr — but the CLI reports the tool call as failed. This also breaks any slash command that uses ! shell-eval in its markdown frontmatter (e.g. /commit-message), which aborts before the model turn starts because the ! command's exit code is non-zero.

What Should Happen?

Bash tool calls should exit with the wrapped command's actual exit code (0 for echo "test", etc.), and ! frontmatter shell-evals should succeed and feed their output into the slash-command context.

Error Messages/Logs

Exit code 1
  test
  /cygdrive/q/Projects/bks.ges.services
  /usr/bin/bash: line 1: /c/Users/OLEGSL~1/AppData/Local/Temp/claude-99a2-cwd: No such file or directory

  Relevant debug log lines appearing for every Bash call:

  [DEBUG] Session environment not yet supported on Windows
  [DEBUG] Spawning shell without login (-l flag skipped)
  [DEBUG] Bash tool error (828ms): Shell command failed
  [DEBUG] Permission suggestions for Bash: [... "//c/Users/Xxxx~1/AppData/Local/Temp//**" ...]
  [DEBUG] Permission suggestions for Bash: [... "//c/Users/XxxYyyy/AppData/Local/Temp//**" ...]

  Note the path-casing inconsistency — short name Xxxx~1 in some suggestions, long name XxxYyyy in others, within
   the same session.

Steps to Reproduce

On Windows with 8.3 short names enabled on C: and a project on a Dev Drive (Q:):

  1. Start claude --debug in the project dir.
  2. Invoke any Bash tool call — e.g. ask: "run echo test for me". Tool reports exit 1 even though test is printed.
  3. Check $TEMP for claude--cwd files: Get-ChildItem $env:TEMP -Filter 'claude--cwd' returns nothing. A fresh random suffix is referenced on each call (99a2, 10ff, 0568, e0ef, b38c, c003, ... observed in one session) but no file is ever written.
  4. Verify it's not antivirus: manually write a file at $TEMP/claude-test-cwd — it survives. Defender (RTP on, Tamper Protected) does not delete it.
  5. Run any slash command that uses ! in frontmatter (e.g. a custom command, which has !git branch --show-current) — command aborts with "Shell command failed" before the model turn starts.

Persists across claude --debug restart.

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

2.1.110

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

  • Windows 11 Enterprise 10.0.26200
  • Native install at C:\Users<user>.local\bin\claude.exe
  • Project dir on a Windows Dev Drive (Q:\Projects...) — /cygdrive/q/... in bash
  • 8.3 short names enabled on C: (C:\Users\XxxYyyy\ ↔ C:\Users\Xxx~1)
  • Wrapper shell is /usr/bin/bash (Cygwin)
  • Possibly related: #7918 (Windows Dev Drive file-modification issues)
  • Hypothesis: the CLI computes the CWD-persist file path using one casing (short name) but the actual file write step uses another (long name) or is being skipped entirely on Windows — consistent with the debug line Session environment not yet supported on Windows. Can attach full debug log on request.

extent analysis

TL;DR

The issue can be fixed by ensuring the shell wrapper creates the CWD-persist file with the correct path casing.

Guidance

  • Verify that the claude-*-cwd file is being created with the correct path casing (short name vs long name) in the $TEMP directory.
  • Check the debug logs for any errors related to file creation or permission issues.
  • Consider modifying the shell wrapper to use the long name for the CWD-persist file path to match the actual file system.
  • Test the fix by running a Bash tool call and checking the exit code and the presence of the claude-*-cwd file.

Example

No code snippet is provided as the issue is related to the shell wrapper and file system interactions.

Notes

The issue may be related to the fact that the Session environment not yet supported on Windows debug line is printed, indicating a potential limitation in the current implementation. Additionally, the path-casing inconsistency may be causing the issue.

Recommendation

Apply a workaround to ensure the shell wrapper creates the CWD-persist file with the correct path casing, such as using the long name for the file path. This should fix the issue until a permanent solution is implemented.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix Every Bash tool call fails on Windows with claude-XXXX-cwd: No such file or directory [1 comments, 2 participants]