You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: New worktree threads fail in a repository with no commits #22017
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
Run git init in an empty folder. Do not commit anything.
Add the folder as a project in T3 Code.
Set new threads to start in a new worktree (Settings, or the project's default).
Start a new thread and send a message.
Expected behavior
The thread starts. A repository with no commits has nothing to check out, so the thread should run in the project folder, as it does for a non-Git project.
Actual behavior
Setup fails at the checkout step and no turn starts:
Workspace preparation failed during provision worktree: Git command failed in GitVcsDriver.createWorktree (<repo>): git worktree add failed
Git itself reports fatal: invalid reference: main, because main has no commit yet. Retry fails the same way. The only way forward is to make a commit or switch the thread to the main checkout.
Linux, git 2.43+. Reproduced by hand with git init -b main repo && cd repo && git worktree add -b t3/x ../wt main, which exits 128 with fatal: invalid reference: main. Not provider specific.
Logs or stack traces
$ git init -q -b main repo &&cd repo
$ git worktree add -b t3/x ../wt main
fatal: invalid reference: main
Workaround
Make an initial commit, or start the thread in the main checkout.
Activity