EEXIST: file already exists, mkdir - startup hang when home directory has ReadOnly attribute on Windows

Status Fixed / completed
Reported on v2.1.69
Maintainer reply None cached
Activity 7 comments · opened Mar 5, 2026 · closed Mar 5, 2026

Bug Description

Claude Code v2.1.69 fails to start (hangs indefinitely) and claude auth login fails with:

Login failed: EEXIST: file already exists, mkdir 'C:\Users\<username>'

The root cause is that the user's home directory has the ReadOnly attribute set (common in corporate/enterprise Windows environments managed by Group Policy). Claude Code's mkdir with recursive: true throws EEXIST instead of succeeding when the target directory already exists but has the ReadOnly flag.

This is a regression — v2.1.68 works correctly on the same system.

Steps to Reproduce

  1. On Windows, have a home directory with ReadOnly attribute:

``
attrib C:\Users\<username>
# Shows: R D A C:\Users\<username>
``

  1. Run claude or claude auth login from any terminal (PowerShell 5.1, PowerShell 7, Git Bash)
  2. Interactive claude hangs indefinitely with blank screen
  3. claude auth login prints the OAuth URL then fails with EEXIST: file already exists, mkdir 'C:\Users\<username>'
  4. claude auth logout also fails with Failed to log out.

What Works

  • claude --version works (exits before hitting the mkdir path)
  • Downgrading to v2.1.68 resolves the issue completely
  • Renaming ~/.claude does not help — the error is on the home directory itself, not .claude
  • Clearing ~/.claude/debug/ does not help

Environment

  • OS: Windows 11
  • Claude Code version: 2.1.69 (broken), 2.1.68 (works)
  • Install method: native (claude.exe)
  • Shell: Tested in Git Bash (MINGW64), PowerShell 5.1, and PowerShell 7
  • Home directory attributes: ReadOnly, Directory, Archive (set by corporate Group Policy)

Expected Behavior

mkdir with recursive: true should handle existing directories with the ReadOnly attribute gracefully, the same as it handles normal existing directories. This worked in v2.1.68.

Workaround

Downgrade to v2.1.68:

npm install -g @anthropic-ai/claude-code@2.1.68

Removing the ReadOnly attribute (attrib -R) from the home directory would also fix it, but is not acceptable in managed corporate environments where this attribute is set by Group Policy.

View original on GitHub ↗

7 Comments

github-actions[bot] · 5 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/30960
  2. https://github.com/anthropics/claude-code/issues/30924
  3. https://github.com/anthropics/claude-code/issues/30932

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

Ra3Valik · 5 months ago

Same issue v. 2.1.69

Bug Description

Claude Code v2.1.69 fails to start correctly and hangs on the “_Do you trust the files in this folder?_” prompt when run as a standalone CLI on Windows.
Even after selecting “Yes” and pressing Enter, the prompt never closes and Claude does not proceed. Selecting “No” closes the prompt and exits after a second.

In the logs, Claude repeatedly outputs:

Failed to save config with lock: Error: EEXIST: file already exists, mkdir 'C:\Users\User'

The directory C:\Users\User already exists and has full write permissions for the current user, so this error appears to be caused by incorrect handling of EEXIST when calling mkdir on an existing directory during config/lock initialization.

This makes the CLI effectively unusable in this environment, because the trust dialog cannot persist the answer and Claude never gets past startup.

Znunu · 5 months ago

Same issue here, downgrading fixed it, thanks

also, I wish that claude code actually showed the debug log or pointed to, it instead of just freezing. Took me long enough to realize that it even exists and where it is.

grossmueller-espirit · 5 months ago

New native installations via PowerShell or CMD also hang forever after printing "Setting up Claude Code". Using the above mentioned npm install method worked.

agroenew-hc · 5 months ago

Confirming identical behaviour on corporate Windows 11 with ReadOnly home directory.
$ cmd //c "attrib C:\Users\agroenew"
R C:\Users\agroenew
[ERROR] Failed to save config with lock: Error: EEXIST: file already exists, mkdir 'C:\Users\agroenew'
v2.1.69 hangs indefinitely. v2.1.68 via npm works perfectly. Domain-joined machine, Group Policy managed.

page1 · 5 months ago

Was having all kinds of issues, Claude found this and we removed read only from project files and now things are working again.

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