claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[BUG] Resuming sessions only works from the directory in which they were started

Open allsey87 opened this issue 5 months ago • 10 comments

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.

allsey87 avatar Aug 14 '25 14:08 allsey87

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/4843
  2. https://github.com/anthropics/claude-code/issues/1977
  3. 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

github-actions[bot] avatar Aug 14 '25 14:08 github-actions[bot]

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.

allsey87 avatar Aug 14 '25 15:08 allsey87

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.

allsey87 avatar Aug 14 '25 15:08 allsey87

+1

hugobiais avatar Sep 08 '25 20:09 hugobiais

+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

leoshatrushin avatar Sep 09 '25 08:09 leoshatrushin

I just got bit by this one as well.

yeroc avatar Sep 10 '25 23:09 yeroc

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.

github-actions[bot] avatar Dec 08 '25 10:12 github-actions[bot]

This is still an issue.

yeroc avatar Dec 08 '25 15:12 yeroc

I can also confirm that this is still an issue. The same issue is also present in the Claude Agent SDK v0.1.62.

nullaus avatar Dec 09 '25 21:12 nullaus

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

adolago avatar Dec 20 '25 13:12 adolago