claude-code - 💡(How to fix) Fix [BUG] Native Windows binary fails on every prompt and command [2 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#51910Fetched 2026-04-23 07:41:38
View on GitHub
Comments
2
Participants
2
Timeline
10
Reactions
0
Author
Timeline (top)
labeled ×4commented ×2mentioned ×2subscribed ×2

Error Message

API Error: EEXIST: file already exists, mkdir 'C:\Users<username>\path\to\claude-code\config'

Root Cause

Additional reproduction: EEXIST on Windows directory junctions in config path

Reproduction

The config path at C:\Users\<username>\path\to\claude-code\config is a Windows directory junction (valid, functions as a real directory). The native build (exe) intermittently fails with:

API Error: EEXIST: file already exists, mkdir 'C:\Users\<username>\path\to\claude-code\config'

Key observations

ScenarioResult
Native build (exe) — cold startEEXIST error
npm package (cli.js) — same junctionWorks correctly
Native build — after running npm packageWorks temporarily
Native build — after some time passesEEXIST error returns
  • The npm package works correctly with the same directory junction and does not replace or modify it
  • After running the npm package, the native build temporarily works again on the exact same unchanged junction
  • After a while, the native build starts failing again
  • The junction itself is never modified by either version — verified with dir /AL

Analysis

This suggests the native build's runtime (Bun) handles fs.mkdir() differently than Node.js when encountering a directory junction. Node.js (used by the npm package) correctly recognizes the junction as an existing directory, while Bun's fs implementation does not — at least under certain initialization conditions.

This is the same mkdir without { recursive: true } root cause discussed in this thread, but the directory junction adds a consistent reproduction path. The intermittent "works after npm run" behavior may indicate that the npm package warms up some cached state that the native build then benefits from temporarily.

Environment

  • OS: Windows 11 Pro (10.0.26200.8037)
  • Claude Code: 2.1.76, native build (exe), direct download
  • Shell: PowerShell 7.5.5

Code Example

> API Error: EEXIST: file already exists, mkdir 'C:\Users\<username>\path\to\claude-code\config'
>
RAW_BUFFERClick to expand / collapse

Additional reproduction: EEXIST on Windows directory junctions in config path

Reproduction

The config path at C:\Users\<username>\path\to\claude-code\config is a Windows directory junction (valid, functions as a real directory). The native build (exe) intermittently fails with:

API Error: EEXIST: file already exists, mkdir 'C:\Users\<username>\path\to\claude-code\config'

Key observations

ScenarioResult
Native build (exe) — cold startEEXIST error
npm package (cli.js) — same junctionWorks correctly
Native build — after running npm packageWorks temporarily
Native build — after some time passesEEXIST error returns
  • The npm package works correctly with the same directory junction and does not replace or modify it
  • After running the npm package, the native build temporarily works again on the exact same unchanged junction
  • After a while, the native build starts failing again
  • The junction itself is never modified by either version — verified with dir /AL

Analysis

This suggests the native build's runtime (Bun) handles fs.mkdir() differently than Node.js when encountering a directory junction. Node.js (used by the npm package) correctly recognizes the junction as an existing directory, while Bun's fs implementation does not — at least under certain initialization conditions.

This is the same mkdir without { recursive: true } root cause discussed in this thread, but the directory junction adds a consistent reproduction path. The intermittent "works after npm run" behavior may indicate that the npm package warms up some cached state that the native build then benefits from temporarily.

Environment

  • OS: Windows 11 Pro (10.0.26200.8037)
  • Claude Code: 2.1.76, native build (exe), direct download
  • Shell: PowerShell 7.5.5

Originally posted by @silver886 in #27791

The issue still present in latest version (2.1.117) and, since npm package (cli.js) is removed, there is no way to make native build works again other than move all config to another folder.

extent analysis

TL;DR

The native build (exe) of Claude Code may fail with an EEXIST error when encountering a Windows directory junction in the config path, potentially due to differences in how Bun's fs implementation handles fs.mkdir() compared to Node.js.

Guidance

  • Verify that the directory junction is correctly configured and functions as expected using the dir /AL command.
  • Consider using the recursive: true option with fs.mkdir() to handle directory junctions, although this may not be directly applicable without modifying the native build's code.
  • If possible, test the native build with a non-junction directory to isolate the issue.
  • Since the npm package is removed, explore alternative workarounds, such as temporarily moving the config to a non-junction directory or investigating caching mechanisms that might be influencing the native build's behavior.

Example

No code snippet is provided due to the lack of specific implementation details in the issue.

Notes

The issue seems to be related to the native build's handling of directory junctions, which may not be directly resolvable without modifying the build process or the fs implementation. The removal of the npm package complicates the situation, as it previously provided a temporary workaround.

Recommendation

Apply workaround: Move the config to a non-junction directory, as this is currently the most reliable method to avoid the EEXIST error with the native build, given the removal of the npm package and the lack of a direct fix.

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 [BUG] Native Windows binary fails on every prompt and command [2 comments, 2 participants]