Skip to content

Project checkout on a fresh clone fails for any branch but the default: "fatal: invalid reference: dev" #5851

Closed

Description

@alexandre-vl

Summary

In a project checkout that bb cloned onto a machine, a thread fails to start whenever its branch is not the remote's default: a new branch from dev, or an existing branch such as release. bb's clone holds only the default branch locally, and for a machine with no checkout yet the picker lists origin's branches without origin/. The host passes that bare name to git, which cannot resolve it.

Versions and environment

  • bb 0.46.1 (latest release). The host daemon runs on Debian 13 (Linux 6.12) with git 2.55.0.
  • Also reproduced from source at main e0f6fda, in the integration harness and the plugin's host test harness on macOS (git 2.54.0, Node 22.23.2). No commit has touched the code below since 0.46.1.
  • The trigger is a checkout like the one bb makes on a new machine: git clone --progress <remote> <path>.

Steps to reproduce

R=$(mktemp -d) && cd "$R"
git init -q --bare -b main origin.git
git init -q -b main seed
git -C seed commit -q --allow-empty -m "on main"
git -C seed push -q ../origin.git main
git -C seed switch -q -c dev && git -C seed commit -q --allow-empty -m "on dev only"
git -C seed push -q ../origin.git dev
git clone -q origin.git clone-b
git -C clone-b branch --list    # * main

bb thread spawn --project <any project on that machine> --host <machine> \
  --environment-provider project-checkout \
  --environment-inputs "{\"path\":\"$R/clone-b\",\"branch\":{\"kind\":\"new\",\"baseBranch\":\"dev\"}}" \
  --prompt "Reply with exactly: OK. Run no command, read no file."

In the app, the picker gives that bare name for a thread whose machine is not created yet (hostId === null): Project checkout → New branch → dev.

With "baseBranch":"origin/dev", the same steps start the thread. The bare name is the trigger.

Expected vs actual

Actual: the thread ends in error, and its log says:

  git switch -C bb/claude-repro-b-base-dev-on-a-plain-clone-to-arch-thr_qakpvmfvxw dev failed: fatal: invalid reference: dev
── Provisioning thread failed ──────────────────────────────
  Workspace setup failed

The plugin's host entry answers the same in such a clone, for a new branch and for an existing one (attach at e0f6fda):

{"status":"failed","message":"git switch -C bb/x dev failed: fatal: invalid reference: dev"}
{"status":"failed","message":"Cannot checkout missing branch release"}

The integration tests in the linked PR hit both errors at e0f6fda, through the server, the daemon and the bundled plugin.

Expected: the new branch starts from origin/dev, release is switched to tracking origin/release, and the thread starts.

Evidence

What you ruled out

Suggested priority and effort

Every project-checkout thread on a bb-cloned machine whose branch is not the default fails to start. For such a machine, the picker offers no way around it. The workaround is the CLI with an origin/-prefixed base, or creating the local branch on the machine by hand. No work is lost. The fix is small, in the plugin's host only.

AGENT GENERATED

Activity

  1. alexandre-vl commented on Oct 20, 2026

    @alexandre-vl
    ContributorAuthor

    Still reproduces on main at 81b48d3, after #5856. In the integration harness, in a plain clone:

    git switch -C bb/reply-with-exactly-ready-and-nothing-else-thr_yv6tnchgtp dev failed: fatal: invalid reference: dev
    Cannot checkout missing branch release
    

    #5856 records the base as given. A fix on the host alone would make the branch from origin/dev and record dev, which does not resolve in that clone, so the thread's commits would drop out of its diff. #5855, reopened and rebuilt on main, has the host report the ref it used. #5885 makes the same fix and is superseded.

    AGENT GENERATED

  2. added a commit that references this issue on Oct 20, 2026
    ebe71b6
  3. added a commit that references this issue on Oct 20, 2026
    809fea2
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