[BUG] Can't restore session when the user name (or more specifically, the home directory) has a period (".") in it, as claude associates the session with a non-existent path/project (the period is replaced with a slash)
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?
When Claude Code records a session (at least on macOS), it creates (if it hasn't already been created) a per-project directory under ~/.claude/projects by taking the path of the project and replacing (presumably) the non-word characters with dashes ("-"). When a session is _read_, the dashes are replaced with slashes ("/") in attempts to recover the associated path.
However, this behavior is fundamentally broken.
Consider my user name: charles.strahan
And consider a project path like: /Users/charles.strahan/src/myawesomeproject
This results in session paths like this: /Users/charles.strahan/.claude/projects/-Users-charles-strahan-src-myawesomeproject/${SESSION_ID}.jsonl
When I then attempt to resume a conversation, the conversation in /Users/charles.strahan/src/myawesomeproject won't show up in the resume-session picker UI, because Claude Code thinks those sessions are associated with /Users/charles/strahan/src/myawesomeproject, _not_ /Users/charles.strahan/src/myawesomeproject.
If I try to resume by launching claude code via claude --resume "${SESSION_ID}", that doesn't work either (for the same reason).
The only way I could get session resumption to work is by doing:
sudo mkdir /Users/charles
sudo chown "charles.strahan" /Users/charles
mkdir /Users/charles/strahan
ln -s /Users/charles.strahan /Users/charles/strahan
And then I can:
cd /Users/charles/strahan/src/myawesomeproject
claude --resume "${SESSION_ID}"
A couple things this isn't:
- This is _not_ an acceptable workaround.
- This is _not_ a matter of me using an unreasonable/invalid user name. It is incredibly common, especially in organizations where laptops/users/email-addresses/etc are centrally managed, for user names to be in the form of
"${FIRST_NAME}.${LAST_NAME}". In fact, that is the case for me: my employer's policy is such that my user name _must_ be charles.strahan.
What Should Happen?
- The session picker UI for
/resume(in both the TUI and in vscode) should find the sessions for the current project (currently, it doesn't). - The
claude --resume "${SESSION_ID}"command should work (currently, it doesn't).
Error Messages/Logs
Steps to Reproduce
- Create/have a user name (or more specifically, a home directory) with a period in it.
- Open claude code somewhere under your user's home directory.
- Start a sessions.
- Close that session.
- Still within that same directory, try to resume the previous session.
- Notice that the last step ended in failure to resume.
Claude Model
_No response_
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.221 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
VS Code integrated terminal
Additional Information
_No response_
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗