claude-code - 💡(How to fix) Fix /branch (/fork) always fails with 'No conversation to branch' in background (daemon-backed thin-client) sessions

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…

Error Message

  • The failure is 100% reproducible in any bg/thin-client session, regardless of message count, regardless of project (tested across multiple repos).
  • The same command in a normal foreground REPL on the same project succeeds.
  • The cwd of the bg session matches its originCwd, so this is not the EnterWorktree-induced cwd-change case from #48254.
  • /btw <question> followed by the f (fork) hotkey does work from the same bg session — suggesting the fork machinery itself isn't broken, only /branch's entry point isn't routed correctly for thin-client mode.

Root Cause

  • #48254 — same error string, but root cause is cwd-change via EnterWorktree resolving the project dir to a different folder. Different mechanism; my session's cwd is stable and matches originCwd, and the error reproduces without ever entering a worktree.
  • #45179 / #48110 — submodule/bare-repo worktree path-resolution issues for /resume, not /branch in thin-client mode.

Fix Action

Fix / Workaround

Route /branch through the daemon when invoked from a thin-client REPL, the same way /btw's fork hotkey works in bg sessions today. Whatever predicate distinguishes thin-client/bg from local REPL for /btw should gate /branch's dispatch as well.

Code Example

~/.claude/jobs/<short>/state.json:
  "sessionId": "923d0a88-3740-4f2c-beb8-76dc32051900",
  "resumeSessionId": "923d0a88-3740-4f2c-beb8-76dc32051900",
  "bridgeSessionId": "cse_01UWkiSRXQbWGRsn8o9wJefR",
  "backend": "daemon",
  "cwd": "/Users/me/projects/foo",
  "originCwd": "/Users/me/projects/foo",

---

~/.claude/projects/-Users-me-projects-foo/923d0a88-3740-4f2c-beb8-76dc32051900.jsonl  (25 lines, growing)
RAW_BUFFERClick to expand / collapse

Bug

/branch (and its alias /fork) always fails with Failed to branch conversation: No conversation to branch when invoked against a background session (daemon-backed thin-client REPL — e.g., the bg/Agents view).

The session JSONL exists on disk under the expected project directory, so the conversation data is there — it just isn't reachable from /branch in thin-client mode.

Environment

  • Claude Code 2.1.143
  • macOS 26.4.1 (arm64)

Repro

  1. Start a background session (Agents View / bg job).
  2. In the thin-client view of that session, type /branch (or /fork).
  3. Failed to branch conversation: No conversation to branch

(Same /branch works fine from a normal local REPL session in the same project.)

Evidence the conversation is on disk

State of the bg session I tested:

~/.claude/jobs/<short>/state.json:
  "sessionId": "923d0a88-3740-4f2c-beb8-76dc32051900",
  "resumeSessionId": "923d0a88-3740-4f2c-beb8-76dc32051900",
  "bridgeSessionId": "cse_01UWkiSRXQbWGRsn8o9wJefR",
  "backend": "daemon",
  "cwd": "/Users/me/projects/foo",
  "originCwd": "/Users/me/projects/foo",

The corresponding jsonl is on disk and accumulating messages normally:

~/.claude/projects/-Users-me-projects-foo/923d0a88-3740-4f2c-beb8-76dc32051900.jsonl  (25 lines, growing)

So this is not a missing-conversation issue — /branch is failing despite a perfectly valid session file at the expected location.

Observed behavior

  • The failure is 100% reproducible in any bg/thin-client session, regardless of message count, regardless of project (tested across multiple repos).
  • The same command in a normal foreground REPL on the same project succeeds.
  • The cwd of the bg session matches its originCwd, so this is not the EnterWorktree-induced cwd-change case from #48254.
  • /btw <question> followed by the f (fork) hotkey does work from the same bg session — suggesting the fork machinery itself isn't broken, only /branch's entry point isn't routed correctly for thin-client mode.

Related (not duplicates)

  • #48254 — same error string, but root cause is cwd-change via EnterWorktree resolving the project dir to a different folder. Different mechanism; my session's cwd is stable and matches originCwd, and the error reproduces without ever entering a worktree.
  • #45179 / #48110 — submodule/bare-repo worktree path-resolution issues for /resume, not /branch in thin-client mode.

Suggested fix

Route /branch through the daemon when invoked from a thin-client REPL, the same way /btw's fork hotkey works in bg sessions today. Whatever predicate distinguishes thin-client/bg from local REPL for /btw should gate /branch's dispatch as well.

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 /branch (/fork) always fails with 'No conversation to branch' in background (daemon-backed thin-client) sessions