zed-industries/zed · error

Operation was canceled

Error message

Operation was canceled

What it means

Generic failure wrapper in the rename-branch confirm flow: repository.update(...rename_branch...) returned an Err (git refused or failed the rename, e.g. invalid branch name or ref collision), and this message carries the underlying error to the UI.

Source

Thrown at crates/git_ui/src/git_ui.rs:489

    fn confirm(&mut self, _: &Confirm, window: &mut Window, cx: &mut Context<Self>) {
        let new_name = self.editor.read(cx).text(cx);
        if new_name.is_empty() || new_name == self.current_branch.as_ref() {
            cx.emit(DismissEvent);
            return;
        }

        let repo = self.repo.clone();
        let current_branch = self.current_branch.to_string();
        cx.spawn(async move |_, cx| {
            match repo
                .update(cx, |repo, _| {
                    repo.rename_branch(current_branch, new_name.clone())
                })
                .await
            {
                Ok(Ok(_)) => Ok(()),
                Ok(Err(error)) => Err(error),
                Err(_) => Err(anyhow!("Operation was canceled")),
            }
        })
        .detach_and_prompt_err("Failed to rename branch", window, cx, |_, _, _| None);
        cx.emit(DismissEvent);
    }
}

impl EventEmitter<DismissEvent> for RenameBranchModal {}
impl ModalView for RenameBranchModal {}
impl Focusable for RenameBranchModal {
    fn focus_handle(&self, cx: &App) -> FocusHandle {
        self.editor.focus_handle(cx)
    }
}

impl Render for RenameBranchModal {
    fn render(&mut self, _: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
        v_flex()

View on GitHub (pinned to f4178619ac)

Solutions

  1. Re-open the branch list and retry the rename; the operation may have been dismissed
  2. Check the repository for pending git operations (`git status`) or locks (.git/index.lock)
  3. Ensure the new branch name is valid and does not already exist
  4. Perform the rename manually with `git branch -m <old> <new>`
Defensive patterns

Strategy: try-catch

When it happens

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

Common situations: See trigger scenarios.


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