Skip to content

[Bug]: Worktree reuse silently breaks on Git < 2.36 (git worktree list --porcelain -z fails, all refs lose worktreePath) #12761

Description

@didiez

Before submitting

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

Area

apps/server

Steps to reproduce

  1. Use a machine with Git < 2.36 (mine: Ubuntu 22.04.3 LTS, stock git 2.34.1; it is the current version in Ubuntu 22.04's repos, so this affects every default 22.04 box).
  2. In a project, leave the main checkout on main and create a worktree:
    git worktree add ~/wt/feat-x -b feat-x
  3. In T3 Code, start a new thread on that project with Workspace = Current checkout.
  4. Open the branch picker and select feat-x.

Expected behavior

feat-x shows the worktree badge in the picker, and selecting it takes the reuseExistingWorktree path: the thread is bound to ~/wt/feat-x, no git command is run, the workspace chip becomes "Current worktree", and no second worktree is created on send.

Actual behavior

No worktree badge is shown on any branch. Selecting feat-x runs git checkout feat-x in the main checkout, which Git correctly refuses:

Git command failed in GitVcsDriver.switchRef.checkout (<project path>): git checkout failed

The real Git message (fatal: 'feat-x' is already checked out at '<worktree path>') never reaches the user — see "secondary issues" below — so the error looks like a T3 worktree bug rather than a Git version problem.

Impact

Major degradation or frequent failure

Version or commit

0.0.43-nightly.20260920.2005

Environment

Ubuntu 22.04.3 LTS

Logs or stack traces

Git command failed in GitVcsDriver.switchRef.checkout (<project path>): git checkout failed

# what git actually said, obtained by hand:
fatal: 'feat/<branch>' is already checked out at '<home>/.t3/worktrees/<project>/<worktree>'

Screenshots, recordings, or supporting files

No response

Workaround

Upgrade Git to ≥ 2.36 on the machine that hosts the project (verified fixed with Git 2.55.0 from ppa:git-core/ppa; the worktree badges reappear and branch selection binds the thread to the existing worktree with no checkout).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is broken or behaving incorrectly.needs-triageIssue needs maintainer review and initial categorization.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions