GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [Bug]: New worktree threads fail in a repository with no commits · Issue #22017 · pingdotgg/t3code

[Bug]: New worktree threads fail in a repository with no commits #22017

New issue
Copy link
New issue
Copy link
Open
#34968
Rivethub/t3.1code
#67
Rivethub/t3.1code#67
Open
[Bug]: New worktree threads fail in a repository with no commits#22017
#34968
Rivethub/t3.1code
#67
Copy link

Description

@Project516
Project516
opened on Oct 19, 2026
Issue body actions

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. Run git init in an empty folder. Do not commit anything.
  2. Add the folder as a project in T3 Code.
  3. Set new threads to start in a new worktree (Settings, or the project's default).
  4. 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.

Impact

Blocks work completely

Version or commit

main @ 673c5e3

Environment

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.

Prior work

  • [Bug]: Creating a thread in an empty git repository (no commits) crashes with "select a thread" #2148 was closed as not reproducible for the dead-route symptom. The closing comment notes that worktree creation without a commit still fails and that a local-mode fallback was not implemented.
  • fix(server): new worktree threads work in repos with no commits yet #15580 added that fallback in ThreadLaunchService and was closed in favor of fix(server): t3_thread_launch refuses a new worktree whose base ref has no commit #17791.
  • fix(server): t3_thread_launch refuses a new worktree whose base ref has no commit #17791 only adds a pre-launch check for the MCP t3_thread_launch tool. It accepts a repository whose HEAD has no commit and leaves that case to fix(server): new worktree threads work in repos with no commits yet #15580, so the failure above still happens on current main for every launch path.
Reacted by BURAKBEY and Charles White

Activity

  1. juliusmarminge commented on Oct 21, 2026

    @juliusmarminge
    juliusmarminge
    on Oct 21, 2026 – with GitCafe Production
    Member
    More actions

    Reproduced on Linux in the web dev app at 70e5e384da: added a folder initialized with git init -b main, selected New worktree, and sent a message. Checkout failed with git worktree add failed (ref_not_found) before the agent started; Retry failed identically. The same flow in a repository with one initial commit created the worktree and completed the turn.

  2. juliusmarminge commented on Oct 22, 2026

    @juliusmarminge
    juliusmarminge
    on Oct 22, 2026 – with GitCafe Production
    Member
    More actions

    The candidate fix passes all 40 focused launch-service tests. Review identified a maintainer decision: the shared fallback also changes t3_thread_launch, so an explicit new-worktree request can execute in the project folder instead. Stopped before publishing a PR under the triage rule for MCP tool-surface changes. The issue remains open.

  3. juliusmarminge commented on Oct 22, 2026

    @juliusmarminge
    juliusmarminge
    on Oct 22, 2026 – with GitCafe Production
    Member
    More actions

    Reproduced again in the Linux web dev app on 05b697f6a2: added a folder initialized with git init -b main, selected New worktree, and sent a message. Workspace preparation failed with git worktree add failed (ref_not_found) before a provider turn started. A regression test and focused fix are in progress.

  4. cornishandy commented on Nov 23, 2026

    @cornishandy
    cornishandy
    on Nov 23, 2026
    More actions

    Still happening on nightly 0.1.12-nightly.20261122.5111, and it also breaks scheduled tasks. An unbound task created with the schedule_task MCP tool gets a worktree strategy whose baseRef falls back to main when no branch ref resolves (scheduledTaskWorkspaceStrategy / resolveScheduledTaskBaseRef in OrchestratorMcpService.ts, main 6b38ec9). ScheduledTaskService.upsert only switches that to the project folder for Scratch or non-Git projects, so in a repo with no commits every such task fails when it fires, before the model starts:

    Workspace preparation failed during provision worktree: Base ref "main" does not resolve to a commit in project "<project>" (<workspace root>).
    

    This happened to me twice (19 and 22 Nov, in a repo with no commits and no remote). A follow-up message sent to the failed thread then stayed queued without starting.

    Unbound scheduled runs go through ThreadLaunchService.launch, so the fallback in #34968 should cover them too (and #39760 would let schedule_task choose the project checkout directly). Until then, binding the task to a thread, or making an initial commit, avoids it.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.