/branch fails with 'No conversation to branch' after EnterWorktree

Resolved 💬 4 comments Opened Apr 15, 2026 by dorianj Closed May 19, 2026

Bug

/branch always fails with Failed to branch conversation: No conversation to branch when the session's working directory has been changed by EnterWorktree. It works fine when the cwd is in the main repo.

Repro

  1. Start a Claude Code session in a git repo (have some conversation first)
  2. Enter a worktree via EnterWorktree (or /wt which calls it)
  3. Try /branch
  4. Failed to branch conversation: No conversation to branch
  5. Exit the worktree back to the main repo
  6. Try /branch again
  7. → Works fine

Root cause (likely)

The session JSONL lives under the original project directory (e.g. ~/.claude/projects/-Users-dorian-dev-caelum/). After EnterWorktree changes the cwd to a worktree path like /Users/dorian/dev/caelum/.claude/worktrees/foo, the /branch command resolves the project directory from the current cwd, landing in a different project path (-Users-dorian-dev-caelum--claude-worktrees-foo) that doesn't contain the running session's JSONL file. So it concludes there's no conversation to branch.

Evidence

Analyzed ~45 /branch invocations across session logs:

  • Every failure (9 instances, excluding 2 empty-session cases) occurred while the session was inside a worktree (has_wt_context=True)
  • Every success (~35 instances) occurred while the session was in the main repo directory
  • 3 sessions that entered and exited a worktree before trying /branch succeeded — confirming the issue is cwd-dependent, not permanent corruption

Environment

  • Claude Code CLI (latest channel)
  • macOS

View original on GitHub ↗

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