zed-industries/zed · error

No active branch

Error message

No active branch

What it means

Raised in create_pull_request when the active repository snapshot has no branch set (repository.branch is None), e.g. the repo is in a detached-HEAD or freshly-initialized state. Without a branch name a PR cannot be targeted, so the operation aborts before any remote call.

Source

Thrown at crates/git_ui/src/git_panel.rs:4247

            }
            let selection = cx
                .update(|window, cx| {
                    picker_prompt::prompt(
                        "Pick which remote to fetch",
                        remotes.iter().map(|r| r.name()).collect(),
                        workspace,
                        window,
                        cx,
                    )
                })
                .ok()?
                .await?;
            remotes.get(selection).cloned()
        })
    }

    pub(crate) fn fetch(
        &mut self,
        is_fetch_all: bool,
        window: &mut Window,
        cx: &mut Context<Self>,
    ) {
        if !self.can_push_and_pull(cx) {
            return;
        }

        let Some(repo) = self.active_repository.clone() else {
            return;
        };
        if !self.start_remote_operation(RemoteOperationKind::Fetch, cx) {
            return;
        }

        telemetry::event!("Git Fetched");
        let askpass = self.askpass_delegate("git fetch", window, cx);
        let this = cx.weak_entity();

View on GitHub (pinned to 5a9b9558db)

Solutions

  1. Check out a real branch with `git checkout -b <name>` instead of staying on a detached HEAD
  2. Commit or stash changes and switch to an existing branch before creating a pull request
  3. Use `git branch` in the terminal to confirm the repository's current branch state
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/git_ui/src/git_panel.rs:4239 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@5a9b9558db (2026-08-20). Data as JSON: /api/errors/df559db4e363212e. Report an issue: GitHub.