[BUG] claude --resume <id> cannot find intact transcript after original worktree path is removed

Resolved 💬 3 comments Opened May 10, 2026 by lyonsno Closed Jun 9, 2026

Summary

claude --resume <session-id> fails with No conversation found with session ID: <id> after the original project/worktree directory has been removed, even though the transcript JSONL is still present on disk and contains the matching sessionId.

Recreating an empty directory at the original path is sufficient to make the same --resume command find and resume the same transcript again. No git metadata or project files are required in the recreated directory.

This appears related to #5768, but the failure mode here is specifically that deleting or moving the original cwd can orphan an otherwise valid transcript that Claude Code itself still keeps under ~/.claude/projects/.

Environment

  • Claude Code: 2.1.138
  • macOS: Darwin 24.6.0
  • Shell: zsh / bash
  • Git worktree created under /tmp (/private/tmp after macOS path canonicalization)

Reproduction

set -euo pipefail

# 1. Set up a throwaway repo and worktree.
BASE="/tmp/cc-resume-repro"
rm -rf "$BASE"
mkdir -p "$BASE/repo"
cd "$BASE/repo"
git init -q -b main
echo repro > README.md
git add README.md
git -c user.email=test@test -c user.name=test commit -q -m init
git worktree add -q ../wt

# 2. Start a non-interactive Claude Code session inside the worktree.
cd ../wt
claude -p "say the word pong and nothing else"
# -> pong

# 3. Locate the transcript. On macOS, /tmp may canonicalize to /private/tmp.
REAL_WT="$(pwd -P)"
PROJECT_DIR="$HOME/.claude/projects/${REAL_WT//\//-}"
SID="$(basename "$(ls -t "$PROJECT_DIR"/*.jsonl | head -n 1)" .jsonl)"
echo "$SID"

# 4. Confirm the transcript contains the matching sessionId.
rg "\"sessionId\":\"$SID\"" "$PROJECT_DIR/$SID.jsonl"

# 5. Remove the worktree.
cd "$BASE/repo"
git worktree remove ../wt

# 6. Confirm the transcript JSONL is still on disk.
ls "$PROJECT_DIR/$SID.jsonl"

# 7. Try to resume from a different cwd.
cd /tmp
claude --resume "$SID" -p "still there?"
# -> No conversation found with session ID: <SID>

# 8. Recreate the original path as an empty directory.
mkdir -p "$BASE/wt"
cd "$BASE/wt"
find . -maxdepth 1 -mindepth 1 -print
# -> no output

# 9. Resume the same session from that empty directory.
claude --resume "$SID" -p "reply with only the word yes"
# -> yes

Expected behavior

When an explicit session ID is passed to --resume, Claude Code should be able to resolve the transcript for the lifetime of the transcript file. Reasonable implementations would include:

  • treating the session ID / JSONL filename as globally unique and resolving it across ~/.claude/projects/;
  • falling back to a global scan when the cwd-derived project directory does not contain the requested session; or
  • storing enough session metadata to make the printed claude --resume <id> continuation command independent of whether the original project directory still exists.

Actual behavior

--resume <id> only finds the transcript when the current cwd maps to the same path-encoded project directory that contains the JSONL.

In the reproduced case:

  • transcript remained at ~/.claude/projects/-private-tmp-cc-resume-repro-...-wt/<SID>.jsonl;
  • the JSONL contained the matching sessionId;
  • claude --resume <SID> from /tmp failed with No conversation found with session ID: <SID>;
  • creating an empty directory at the original worktree path made the same --resume <SID> succeed.

Why this matters

This affects workflows that use disposable project directories or git worktrees. The CLI prints claude --resume <id> as the continuation affordance, but that command can become unusable after ordinary cleanup even though the transcript still exists and is identifiable by its UUID.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗