[BUG] Windows: Trust dialog stuck — Enter key does nothing due to mkdirSync EEXIST error
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?
Bug Description
On Windows 11, the workspace trust dialog appears but pressing Enter does nothing. The dialog gets stuck indefinitely, preventing th launch of interactive sessions in any new project directory.
Root Cause
The config save function in cli.js calls mkdirSync(dirname(configPath)) without {recursive: true}. The config file is ~/.claude.json, so dirname resolves to C:\Users\<username> — which already exists. mkdirSync throws EEXIST, the trust dialog answer can't be saved, and the dialog loops.
From the debug log:
Stack trace:
at mkdirSync (unknown)
at mkdirSync (B:/~BUN/root/src/entrypoints/cli.js:12:3048)
at d38 (B:/~BUN/root/src/entrypoints/cli.js:6483:5856)
at IA (B:/~BUN/root/src/entrypoints/cli.js:6483:4432)
Both d38() and B38() in cli.js call mkdirSync on the config parent directory without EEXIST handling (unlike the backup directory code which does catch it).
What Should Happen?
Change mkdirSync(L) to mkdirSync(L, { recursive: true }) in both d38 and B38 functions, or wrap with try/catch for EEXIST like the backup code already does.
Workaround
Manually add trust entries to ~/.claude.json under projects.<path>.hasTrustDialogAccepted: true for each project directory, using both forward-slash and backslash path variants.
Environment
- Windows 11 Enterprise 10.0.22631
- Claude Code v2.1.51 (native install, org-managed)
- Terminal: Windows Terminal (cmd)
- Bun runtime (standalone binary)
Error Messages/Logs
Steps to Reproduce
Steps to Reproduce
- Install Claude Code on Windows 11 (native install via org-managed deployment)
- Open Windows Terminal (cmd or PowerShell)
- Navigate to any project directory that has NOT been previously trusted:
cd C:\Users<username>\Documents<any-new-project>
- Run
claude(interactive mode) - The workspace trust dialog appears:
Accessing workspace:
C:\Users<username>\Documents<project>
❯ 1. Yes, I trust this folder ✔
- No, exit
Enter to confirm · Esc to cancel
- Press Enter — nothing happens. The dialog stays. Cannot proceed.
Expected Behavior
Pressing Enter should accept the trust selection, save the config, and launch the interactive session.
Actual Behavior
Enter does nothing. Debug log (~/.claude/debug/*.txt) shows repeated errors:
[ERROR] Failed to save config with lock: Error: EEXIST: file already exists, mkdir 'C:\Users<username>'
The trust dialog answer cannot be persisted, so the dialog loops forever.
Additional Context
- The
-p(print) flag skips the trust dialog successfully, confirming it's specific to the interactive trust prompt save path - Directories that already have
hasTrustDialogAccepted: truein~/.claude.jsonwork fine - The workaround is manually adding trust entries to
~/.claude.json - The bug is in the
d38()andB38()functions incli.jswhich callmkdirSync(dirname(configPath))without{ recursive: true }— whenconfigPathis~/.claude.json,dirnameis the home directory which already exists
Claude Model
None
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
v2.1.51 (native install, org-managed)
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
_No response_
This issue has 8 comments on GitHub. Read the full discussion on GitHub ↗