claude-code - 💡(How to fix) Fix [BUG] End-of-session resume hint includes --worktree flag that fails when session crossed into a nested repo's worktree [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#55128Fetched 2026-05-01 05:45:31
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Timeline (top)
labeled ×4commented ×1

Code Example

Resume this session with:
   claude --worktree feature-x --resume <session-id>
RAW_BUFFERClick to expand / collapse

What's Wrong?

When a session is started in a parent repo and cds into a worktree of a nested repo during the session, the end-of-session resume hint includes --worktree <name>, but that command fails with "No conversation found".

The session JSONL is stored under the parent repo's project key (where claude was originally launched), so the printed --worktree flag points Claude Code to look up the session under a project key that doesn't exist.

This is the inverse of #28769 (closed): there, the hint printed without --worktree when one was needed; here, the hint prints with --worktree when it shouldn't.

What Should Happen?

The printed resume command should actually work when copy-pasted. Either:

  • Don't include --worktree in the hint when the session was launched from the parent (not the worktree), or
  • Store the session under the worktree's project key if --worktree is going to be in the hint

Steps to Reproduce

  1. Have a parent repo ~/parent that contains a nested repo at ~/parent/nested
  2. Create a worktree inside the nested repo, e.g. ~/parent/nested/.claude/worktrees/feature-x
  3. From ~/parent, launch claude
  4. During the session, work happens in the nested repo's worktree (cwd moves to ~/parent/nested/.claude/worktrees/feature-x)
  5. Exit. Claude prints:
    Resume this session with:
    claude --worktree feature-x --resume <session-id>
  6. Run that exact command from ~/parentNo conversation found with session ID: <id>
  7. Drop --worktree and it resumes fine: claude --resume <session-id>

Investigation

The session JSONL lives at ~/.claude/projects/-Users-<me>-parent/<session-id>.jsonl (parent repo's project key) — confirmed by inspecting the file and the recorded cwd entries, which span both /Users/<me>/parent and /Users/<me>/parent/nested/.claude/worktrees/feature-x.

Compounding: if the same worktree name exists in both the parent and nested repos, --worktree <name> is ambiguous on its own.

Likely related to the worktree path resolution logic discussed in #45179.

Claude Code Version

2.1.123

Platform

Anthropic API

OS

macOS (Darwin 25.4.0)

Related

  • #28769 (closed) — inverse symptom (missing --worktree in hint)
  • #45179 (open) — /resume picker breaks with submodule + secondary worktree; same code path likely involved

extent analysis

TL;DR

The issue can be worked around by removing the --worktree flag from the resume command printed by Claude.

Guidance

  • The problem occurs because the session JSONL is stored under the parent repo's project key, but the resume hint includes --worktree, which points to a non-existent project key.
  • To verify the issue, check the session JSONL file location and the cwd entries to confirm that the session was started in the parent repo and cded into a worktree of a nested repo.
  • To mitigate the issue, remove the --worktree flag from the resume command, as it is not necessary when resuming a session started from the parent repo.
  • Consider storing the session under the worktree's project key if --worktree is included in the hint to avoid this issue.

Example

No code snippet is provided as it is not necessary to illustrate the workaround.

Notes

This issue is related to the worktree path resolution logic, and a similar issue (#28769) was previously closed. However, the current issue is the inverse of the previous one, where the hint includes --worktree when it shouldn't.

Recommendation

Apply the workaround by removing the --worktree flag from the resume command, as it is a simple and effective solution to the problem.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [BUG] End-of-session resume hint includes --worktree flag that fails when session crossed into a nested repo's worktree [1 comments, 2 participants]