Claude Code CLI fails on Windows when username path contains spaces
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 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
- Install Claude Code CLI on Windows with a username containing spaces
(e.g., "Mario Rossi", resulting in C:\Users\Mario Rossi\)
- Run
claudefrom any directory (without setting CLAUDE_HOME) - Observe that Claude Code fails to start or behaves unexpectedly
- Set environment variable CLAUDE_HOME=C:\ClaudeHome\ (path without spaces)
- Run
claudeagain — 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)
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗