t3_thread_launch accepts an explicit branch that already exists, then the thread fails with branch_already_exists#31263
What happened
An agent launched a new worktree thread through t3_thread_launch with a branch name that already existed and was checked out in another T3 worktree. The tool call reported success, so the agent carried on. The new thread then failed before its provider started, and the error didn't name the branch.
Diagnosis
checkWorktreeBase is the check t3_thread_launch runs before it accepts a launch. It validates the base ref, not whether the requested branch already exists. Provisioning then runs in the background, where GitVcsDriverCore.createWorktree runs createBranchAt unconditionally, and git refuses. By then the caller already has a threadId and runId, so an agent can't correct the name in the same turn.
The message also reports the wrong step and leaves out the branch: the failing command is git branch, but the text says git worktree add failed.
This is still the code on main at 935818e4.
Steps to reproduce
Reproduced against an isolated server on 0.1.7 and on 0.1.8-nightly.20261104.4192:
git init -b main repo && cd repo && git commit --allow-empty -m initgit worktree add -b feature/taken ../wtt3 project add .t3 thread start --json --worktree main --branch feature/taken --provider claudeAgent --model claude-haiku-5-5 . "reply ok"
The command exits 0 and prints a threadId and runId. The thread then fails with the error under Evidence.
On 0.1.7 I got the same result for a branch that exists but isn't checked out anywhere (git branch feature/idle).
Expected: the caller finds out in the tool result that the branch is taken, and no failed thread is left behind.
Version
0.1.6 (first hit), reproduced on 0.1.7 and 0.1.8-nightly.20261104.4192
Environment
macOS 26.7.1, git 2.54.0, Node v26.0.0, Claude Code 2.1.318
Evidence
| 1 | $ t3 thread start --json --worktree main --branch feature/taken ... |
| 2 | {"threadId":"mcp:<id>","projectId":"<id>","runId":"run:thread:mcp%3A<id>:ordinal:1"} |
| 3 | exit=0 |
| 4 | |
| 5 | # failure recorded on the thread |
| 6 | Workspace preparation failed during provision worktree: Git command failed in GitVcsDriver.createWorktree.createBranch (<project>): git worktree add failed (branch_already_exists) |
| 7 | |
| 8 | # git state afterwards: the existing branch and worktree are untouched, nothing new |
| 9 | <project> [main] |
| 10 | <wt> [feature/taken] |
In the original occurrence (0.1.6) the launch failed about 57 ms into worktree creation.
Related issues
Not a duplicate of these, which share the error or code path:
- #26577: same error, but that report is about the failure taking 7 hours to appear.
- #29515 and #29584: a branch left behind by a failed checkout. Here the branch existed before the launch, so that cleanup doesn't apply.
- #29297 and #29328: a branch name blocked by its prefix. The new pre-check only matches
existing/andbranch/prefixes, so an exact match still gets through. - #29228: renames a taken branch to
name-1. #29328 says explicit names are never renamed, so the two PRs disagree on what should happen. That direction is the decision a maintainer needs to make here.
If refusing is the direction, adding an exact-name match to the #29328 pre-check would cover this.
Fix applied or workaround
Pick an unused branch name and launch again. Nothing was changed on the machine.
Filed by
Claude Opus 5.5 in Claude Code (running inside T3 Code), following the T3 triage playbook. Filed with gh, because this account can't apply the via-triage label.