claude-code - 💡(How to fix) Fix Claude Code CLI fails on Windows when username path contains spaces [2 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#47943Fetched 2026-04-15 06:37:54
View on GitHub
Comments
2
Participants
2
Timeline
6
Reactions
0
Author
Timeline (top)
labeled ×3commented ×2cross-referenced ×1

Error Message

Error Messages/Logs

Claude Code fails to initialize. Error related to path resolution

Fix Action

Fix / Workaround

The workaround is to set the CLAUDE_HOME environment variable to a path without spaces (e.g., CLAUDE_HOME=C:\ClaudeHome). This allows Claude Code to start and work normally.

This issue affects all Windows users whose Windows username contains a space, which is extremely common (e.g., "Nome Cognome"). A native fix or official documentation of the CLAUDE_HOME workaround would benefit many users.

Code Example

Claude Code fails to initialize. Error related to path resolution 
when USERPROFILE or APPDATA contains spaces.
RAW_BUFFERClick to expand / collapse

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?

Claude Code CLI fails to start or behaves unexpectedly on Windows when the user profile path contains spaces (e.g., C:\Users\Mario Rossi).

This was previously reported in issue #31418 (now locked). The issue persists and has not received an official fix or acknowledgment.

The only working solution found by affected users is setting the CLAUDE_HOME environment variable to a path without spaces (e.g., C:\ClaudeHome).

What Should Happen?

Claude Code CLI should start and operate normally regardless of whether the Windows username or profile path contains spaces.

Error Messages/Logs

Claude Code fails to initialize. Error related to path resolution 
when USERPROFILE or APPDATA contains spaces.

Steps to Reproduce

  1. Install Claude Code CLI on Windows with a username containing spaces (e.g., "Mario Rossi", resulting in C:\Users\Mario Rossi)
  2. Run claude from any directory (without setting CLAUDE_HOME)
  3. Observe that Claude Code fails to start or behaves unexpectedly
  4. Set environment variable CLAUDE_HOME=C:\ClaudeHome\ (path without spaces)
  5. Run claude again — it works correctly

Note: This issue was previously reported in #31418 (now locked without a confirmed fix).

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

No response

Claude Code Version

2.1.71 (Claude Code)

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Windows Terminal

Additional Information

The workaround is to set the CLAUDE_HOME environment variable to a path without spaces (e.g., CLAUDE_HOME=C:\ClaudeHome). This allows Claude Code to start and work normally.

This issue affects all Windows users whose Windows username contains a space, which is extremely common (e.g., "Nome Cognome"). A native fix or official documentation of the CLAUDE_HOME workaround would benefit many users.

Reference: #31418 (closed and locked without confirmed fix)

extent analysis

TL;DR

Setting the CLAUDE_HOME environment variable to a path without spaces is a reliable workaround for the issue.

Guidance

  • Verify that the issue is indeed caused by spaces in the Windows username or profile path by checking the USERPROFILE and APPDATA environment variables.
  • Set the CLAUDE_HOME environment variable to a path without spaces (e.g., C:\ClaudeHome\) to work around the issue.
  • Test the workaround by running claude from any directory after setting CLAUDE_HOME.
  • Consider reporting the issue to the maintainers with detailed steps to reproduce, as it has been previously reported but not officially fixed.

Example

No code snippet is necessary, as the workaround involves setting an environment variable.

Notes

The issue seems to be a regression, as it was reported to have worked in a previous version. The CLAUDE_HOME workaround is effective but may not be a permanent solution.

Recommendation

Apply the workaround by setting CLAUDE_HOME to a path without spaces, as it is a reliable and straightforward solution to the issue.

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