[BUG] Claude Code hangs on startup / auth fails with "EEXIST: file already exists, mkdir 'C:\Users\<username>"
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?
Claude Code hangs completely on startup after having worked normally. Authentication also fails with Login failed: EEXIST: file already exists, mkdir 'C:\Users\<username>'. The error in the debug log is:
[ERROR] Failed to save config with lock: Error: EEXIST: file already exists, mkdir 'C:\Users\rhagen'
Claude Code appears to be attempting to create the user's home directory (C:\Users\rhagen) as if it does not exist, when it clearly does. This seems to be a bug in the config file locking logic — it is treating the home directory path as a file/directory to create rather than an existing directory to write inside.
What Should Happen?
Claude Code launches normally.
Error Messages/Logs
Debug Log
2026-03-05T03:35:20.425Z [DEBUG] detectFileEncoding failed for expected reason: ENOENT
2026-03-05T03:35:20.426Z [DEBUG] MDM settings load completed in 13ms
2026-03-05T03:35:20.428Z [DEBUG] detectFileEncoding failed for expected reason: ENOENT
2026-03-05T03:35:20.428Z [DEBUG] Broken symlink or missing file encountered for settings.json at path: C:\Users\rhagen\.claude\settings.json
2026-03-05T03:35:20.429Z [DEBUG] detectFileEncoding failed for expected reason: ENOENT
2026-03-05T03:35:20.429Z [DEBUG] Broken symlink or missing file encountered for settings.json at path: C:\Users\rhagen\.claude\settings.json
2026-03-05T03:35:20.429Z [DEBUG] detectFileEncoding failed for expected reason: ENOENT
2026-03-05T03:35:20.429Z [DEBUG] Broken symlink or missing file encountered for settings.json at path: C:\EpicSource\UserWeb\Branches\U01200 - API\.claude\settings.json
2026-03-05T03:35:20.429Z [DEBUG] detectFileEncoding failed for expected reason: ENOENT
2026-03-05T03:35:20.429Z [DEBUG] Broken symlink or missing file encountered for settings.json at path: C:\EpicSource\UserWeb\Branches\U01200 - API\.claude\settings.local.json
2026-03-05T03:35:20.430Z [DEBUG] detectFileEncoding failed for expected reason: ENOENT
2026-03-05T03:35:20.430Z [DEBUG] Broken symlink or missing file encountered for settings.json at path: C:\ProgramData\ClaudeCode\managed-settings.json
2026-03-05T03:35:20.430Z [DEBUG] detectFileEncoding failed for expected reason: ENOENT
2026-03-05T03:35:20.430Z [DEBUG] Broken symlink or missing file encountered for settings.json at path: C:\ProgramData\ClaudeCode\managed-settings.json
2026-03-05T03:35:20.430Z [DEBUG] [init] configureGlobalMTLS starting
2026-03-05T03:35:20.430Z [DEBUG] [init] configureGlobalMTLS complete
2026-03-05T03:35:20.430Z [DEBUG] [init] configureGlobalAgents starting
2026-03-05T03:35:20.430Z [DEBUG] [init] configureGlobalAgents complete
2026-03-05T03:35:20.484Z [DEBUG] Using bash path: "C:\Program Files\Git\bin\bash.exe"
2026-03-05T03:35:20.486Z [DEBUG] Error log sink initialized
2026-03-05T03:35:20.487Z [DEBUG] detectFileEncoding failed for expected reason: ENOENT
2026-03-05T03:35:20.487Z [DEBUG] Broken symlink or missing file encountered for settings.json at path: C:\Users\rhagen\.claude\settings.json
2026-03-05T03:35:20.489Z [ERROR] Failed to save config with lock: Error: EEXIST: file already exists, mkdir 'C:\Users\rhagen'
2026-03-05T03:35:20.516Z [DEBUG] Git remote URL: null
2026-03-05T03:35:20.516Z [DEBUG] No git remote URL found
Steps to Reproduce
Launch claude from any directory in PowerShell or CMD
Terminal hangs indefinitely with no output
Running claude auth logout returns "Failed to log out"
Running claude auth login prompts browser authentication, but after authorizing returns: Login failed: EEXIST: file already exists, mkdir 'C:\Users\rhagen'
Deleting %USERPROFILE%\.claude entirely and retrying claude auth login reproduces the same error
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
2.1.33 (npm install)
Claude Code Version
2.1.69 (native installer)
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
PowerShell
Additional Information
Issue began suddenly without any changes on the user's end
All environment variables resolve correctly (USERPROFILE, HOMEPATH, HOMEDRIVE, USERNAME)
https://api.anthropic.com/v1/models is reachable and returns 401 as expected, so network connectivity is not the issue
Permissions on %USERPROFILE%\.claude are correct (user has full control)
Reproduced in both PowerShell and CMD
Reproduced after full deletion of %USERPROFILE%\.claude and reinstallation
User is on a Windows domain account (EPIC\rhagen) which may be a contributing factor
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗