zed-industries/zed · error

Stash has changed, drop aborted

Error message

Stash has changed, drop aborted

What it means

Guard in remove_stash (drop): the sha recorded in the commit view no longer matches the stash entry at that index, meaning the stash list mutated; dropping would delete the wrong (or nonexistent) entry, so the drop is aborted.

Source

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

                        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) {
        Self::stash_action(
            workspace,
            "Drop",
            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, drop aborted"));
                    }
                    Ok(repo.stash_drop(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 stash_action<AsyncFn>(

View on GitHub (pinned to f4178619ac)

Solutions

  1. Abort the drop and surface a 'stash changed' message
  2. Refresh the stash list in the UI before any further stash mutation
  3. Require the user to confirm against the refreshed list
  4. Treat the mismatch as a safety check, not a git failure
Defensive patterns

Strategy: validation

When it happens

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