claude-code - 💡(How to fix) Fix Bash tool fails with EEXIST when session-env path resolves through a reparse point (OneDrive Files-On-Demand) [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#51702Fetched 2026-04-22 07:55:08
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Timeline (top)
labeled ×3closed ×1commented ×1

On Windows, every Bash tool invocation fails with EEXIST: file already exists, mkdir ... when the per-session directory at ~/.claude/session-env/<session-id> resolves through a reparse point — specifically a OneDrive Files-On-Demand cloud placeholder inside a OneDrive-synced .claude folder. PowerShell is unaffected, so the session keeps working but every command hits a permission prompt.

Error Message

EEXIST: file already exists, mkdir 'C:\Users\<user>\.claude\session-env\<session-uuid>'

Root Cause

On Windows, every Bash tool invocation fails with EEXIST: file already exists, mkdir ... when the per-session directory at ~/.claude/session-env/<session-id> resolves through a reparse point — specifically a OneDrive Files-On-Demand cloud placeholder inside a OneDrive-synced .claude folder. PowerShell is unaffected, so the session keeps working but every command hits a permission prompt.

Fix Action

Workaround

Rewire session-env out of OneDrive:

rd /s /q "C:\Users\<user>\OneDrive\Documents\_symbolic_links\.claude\session-env"
mkdir "C:\Users\<user>\AppData\Local\Claude\session-env"
mklink /D "C:\Users\<user>\OneDrive\Documents\_symbolic_links\.claude\session-env" "C:\Users\<user>\AppData\Local\Claude\session-env"

Code Example

EEXIST: file already exists, mkdir 'C:\Users\<user>\.claude\session-env\<session-uuid>'

---

rd /s /q "C:\Users\<user>\OneDrive\Documents\_symbolic_links\.claude\session-env"
mkdir "C:\Users\<user>\AppData\Local\Claude\session-env"
mklink /D "C:\Users\<user>\OneDrive\Documents\_symbolic_links\.claude\session-env" "C:\Users\<user>\AppData\Local\Claude\session-env"
RAW_BUFFERClick to expand / collapse

Summary

On Windows, every Bash tool invocation fails with EEXIST: file already exists, mkdir ... when the per-session directory at ~/.claude/session-env/<session-id> resolves through a reparse point — specifically a OneDrive Files-On-Demand cloud placeholder inside a OneDrive-synced .claude folder. PowerShell is unaffected, so the session keeps working but every command hits a permission prompt.

Environment

  • OS: Windows 11 Home (10.0.26200)
  • Claude Code: running in CLI; .claude folder is symlinked into OneDrive via a junction
  • OneDrive Files-On-Demand is enabled
  • Inside the OneDrive-synced .claude, the session-env subfolder and per-session UUID subfolders exist as OneDrive cloud placeholders

Error

EEXIST: file already exists, mkdir 'C:\Users\<user>\.claude\session-env\<session-uuid>'

Suggested fix

Treat the per-session mkdir as idempotent, e.g. fs.mkdirSync(path, { recursive: true }), so an existing directory (symlink or cloud placeholder) doesn't abort setup.

Workaround

Rewire session-env out of OneDrive:

rd /s /q "C:\Users\<user>\OneDrive\Documents\_symbolic_links\.claude\session-env"
mkdir "C:\Users\<user>\AppData\Local\Claude\session-env"
mklink /D "C:\Users\<user>\OneDrive\Documents\_symbolic_links\.claude\session-env" "C:\Users\<user>\AppData\Local\Claude\session-env"

extent analysis

TL;DR

Treat the per-session mkdir as idempotent to prevent setup abortion due to existing directories or symlinks.

Guidance

  • Verify if the error persists when the .claude folder is not synced with OneDrive or not using a junction.
  • Consider using fs.mkdirSync(path, { recursive: true }) to make the mkdir operation idempotent.
  • As a temporary workaround, rewire the session-env directory out of OneDrive using the provided commands.
  • Test the workaround by invoking a Bash tool after reconfiguring the session-env directory.

Example

No explicit code example is provided, but the suggested fix implies modifying the mkdir call to include the recursive option, e.g., fs.mkdirSync(path, { recursive: true }).

Notes

This solution assumes that the issue is specific to the interaction between Bash, OneDrive, and the junctioned .claude folder. The provided workaround may not be suitable for all environments or use cases.

Recommendation

Apply the workaround by reconfiguring the session-env directory, as it provides a clear and temporary solution to the issue. This approach allows for continued use of the Bash tools while a more permanent fix is explored.

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