Skip to content
Source
Sign inSign up
pingdotgg/t3code

[Bug]: Thread already exists error when selecting "new worktree" option and starting the chat #5721

Closedashukumar2001(GitHub profile, opens in a new tab) opened this issue 2 comments

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/desktop

Steps to reproduce

Image

Expected behavior

It should start the chat with new worktree

Actual behavior

currently it's showing thread already exists and cannot be created twice

Impact

Blocks work completely

Version or commit

No response

Environment

No response

Logs or stack traces

Screenshots, recordings, or supporting files

Image

Workaround

No response

  1. ashukumar2001(GitHub profile, opens in a new tab) added labelsneeds-triage

  2. The "already exists" message is a rollback artifact, not the real failure — worth checking your ~/.t3/userdata/logs/server.trace.ndjson for the error that precedes it. In my case the sequence was:

    thread.created
    GitCommandError: Git command failed in GitVcsDriver.resolveRemoteTrackingCommit
    thread.deleted            (~330 ms after creation, bootstrap rollback)
    thread.create retried with the same threadId → invariant "already exists"

    The underlying cause for me was Start from origin with a base branch that exists locally but was never pushed: prepareWorktree only checks that the origin remote exists (the #5556 guard), then runs git rev-parse --verify refs/remotes/origin/<base>^{commit}, which exits 128. Filed as #8191.

    Since you were on the new worktree option, this may be the same root cause — the base branch shown as From origin/… in the branch toolbar has no refs/remotes/origin/... counterpart. Quick check: turn off Start from origin for that project, or run git rev-parse --verify "refs/remotes/origin/<your base branch>^{commit}" in the repo. If that fails, it's #8191; if the preceding log line is a different GitCommandError, it's another trigger for the shared stale-draft-ID behavior in #4647.

    Either way the actionable git stderr is never surfaced in the UI, which is what makes this class of failure so hard to self-diagnose.

  3. Reproduced from the mobile client (Android), which this issue's screenshots don't cover — same rollback-artifact signature, so confirming the desktop/mobile behavior is identical.

    Version: T3 Code 0.0.34-nightly.20260824.1179 (desktop acting as server, mobile UI driving thread creation)

    What I saw on the phone:

    1. First attempt → task fails to start with Git command failed in GitVcsDriver.resolveRemoteTrackingCommit (/home/huso/code/MUNygo) — exited with non-zero status (#8191: base branch was local-only, no refs/remotes/origin/<branch>).
    2. Retried the same new-worktree creation → red banner "Worktree creation failed — fatal: '.claude/worktrees/still-water-8998' already exists", with the hint "Try selecting a different name or removing the existing directory" — not actionable from a phone when the directory lives on the server.

    Post-mortem on the server confirmed the #5721/#8191 sequence exactly: no still-water-8998 path or worktree registration survived anywhere (git worktree list, filesystem, .git/worktrees all clean) — consistent with bootstrap-rollback cleanup deleting the thread/worktree between attempts while the second attempt raced the half-swept path.

    Two unpushed branches in the picker triggered it deterministically; switching the base to one with an upstream works every time.

    +1 on the missing actionable stderr being what makes this class of failure so hard to self-diagnose — on mobile there is currently no surface at all for the underlying git error.

Sign in to join this conversation.