Skip to content

[BUG] Windows: Trust dialog stuck — Enter key does nothing due to mkdirSync EEXIST error #31156

Description

@peregori

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • 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

  1. Install Claude Code on Windows 11 (native install via org-managed deployment)
  2. Open Windows Terminal (cmd or PowerShell)
  3. Navigate to any project directory that has NOT been previously trusted:

cd C:\Users\Documents

  1. Run claude (interactive mode)
  2. The workspace trust dialog appears:

Accessing workspace:
C:\Users\Documents
❯ 1. Yes, I trust this folder ✔
2. No, exit
Enter to confirm · Esc to cancel

  1. 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'

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: true in ~/.claude.json work fine
  • The workaround is manually adding trust entries to ~/.claude.json
  • The bug is in the d38() and B38() functions in cli.js which call mkdirSync(dirname(configPath)) without { recursive: true } — when configPath is ~/.claude.json, dirname is 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingplatform:windowsIssue specifically occurs on WindowsstaleIssue is inactive

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions