zed-industries/zed · error

Stash has changed, pop aborted

Error message

Stash has changed, pop aborted

What it means

Guard in the commit view's pop_stash action: stash_matches_index fails because the stash list changed since the user opened the dialog (stashes dropped/created elsewhere), so the recorded stash no longer matches. The pop is aborted to avoid popping the wrong stash.

Solutions

  1. Abort the pop and notify the user the stash changed
  2. Refresh the stash list and re-render the view
  3. Let the user re-select and re-run pop on the current entry
  4. Keep the stash entry untouched to avoid silent data loss
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/git_ui/src/commit_view.rs:807 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/7e28915b18b20c82. Report an issue: GitHub.

Appendix: source

Thrown at crates/git_ui/src/commit_view.rs:807

                        return Err(err);
                    }
                };
                Self::close_commit_view(commit_view, workspace, cx).await?;
                anyhow::Ok(())
            },
        );
    }

    fn pop_stash(workspace: &mut Workspace, window: &mut Window, cx: &mut App) {
        Self::stash_action(
            workspace,
            "Pop",
            window,
            cx,
            async move |repository, sha, stash, commit_view, workspace, cx| {
                let result = repository.update(cx, |repo, cx| {
                    if !stash_matches_index(&sha, stash, repo) {
                        return Err(anyhow::anyhow!("Stash has changed, pop aborted"));
                    }
                    Ok(repo.stash_pop(Some(stash), cx))
                });

                match result {
                    Ok(task) => task.await?,
                    Err(err) => {
                        Self::close_commit_view(commit_view, workspace, cx).await?;
                        return Err(err);
                    }
                };
                Self::close_commit_view(commit_view, workspace, cx).await?;
                anyhow::Ok(())
            },
        );
    }

    fn remove_stash(workspace: &mut Workspace, window: &mut Window, cx: &mut App) {

View on GitHub (pinned to f4178619ac)