[BUG] Resuming sessions only works from the directory in which they were started
Environment
- Platform (select one):
- [ ] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [X] Other: Desktop
- Claude CLI version: 1.0.80 (Claude Code)
- Operating System: Debian Linux
- Terminal: VS Code terminal + bash
Bug Description
It is only possible to resume conversations from the same directory in which they are started.
Steps to Reproduce
Start a session with claude --session-id UUID
End that session and change to another directory
Try to resume the session with claude --resume UUID
Expected Behavior
Session should be resumed
Actual Behavior
Error: No conversation found with session ID: UUID
Additional Context
The problem seems to be that Claude is storing its conversations under /home/USER/.claude/projects/PROJECT_PATH/ where project path is a string built from the current working directory with the slashes removed.
Found 3 possible duplicate issues:
- https://github.com/anthropics/claude-code/issues/4843
- https://github.com/anthropics/claude-code/issues/1977
- https://github.com/anthropics/claude-code/issues/4926
This issue will be automatically closed as a duplicate in 3 days.
- If your issue is a duplicate, please close it and 👍 the existing issue instead
- To prevent auto-closure, add a comment or 👎 this comment
🤖 Generated with Claude Code
Some of the issues marked above are related but not duplicates. This issue focuses specifically on the --session-id UUID and --resume UUID pair of arguments which should be independent of the current working directory. This does not apply to --continue to which probably should continue the last conversation that took place in the current working directory.
A simple solution to this problem which would require very few changes would be to search all of /home/USER/.claude/projects/ for a conversation when the UUID is explicitly given.
+1
+1. Our use case is in the sdk - we duplicate the root directory structure on every iteration to save history, but want to resume in the new directory
I just got bit by this one as well.
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
This is still an issue.
I can also confirm that this is still an issue. The same issue is also present in the Claude Agent SDK v0.1.62.
Just hit another variant of this issue. When using the resume menu (claude --resume) with A to show all projects, selecting a session from a different directory generates the wrong cd command.
What happened:
Session was created in /home/artur/Repositories (confirmed in ~/.claude/history.jsonl): {"project":"/home/artur/Repositories","sessionId":"XXX"}
But when resuming from /home/artur/Repositories/tinygrad, the menu showed: This conversation is from a different directory.
To resume, run: cd /home/artur/Repositories/tinygrad && claude --resume XXX
Running that command: No conversation found with session ID: XXX
The resume menu should read the project field from the history file instead of using pwd.
Environment: Claude Code v2.0.69, Linux