{"record":{"id":"ed4bbe9fb0c36290","repo":"zed-industries/zed","slug":"stash-has-changed-drop-aborted","errorCode":null,"errorMessage":"Stash has changed, drop aborted","messagePattern":"Stash has changed, drop aborted","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/git_ui/src/commit_view.rs","lineNumber":834,"sourceCode":"                        return Err(err);\n                    }\n                };\n                Self::close_commit_view(commit_view, workspace, cx).await?;\n                anyhow::Ok(())\n            },\n        );\n    }\n\n    fn remove_stash(workspace: &mut Workspace, window: &mut Window, cx: &mut App) {\n        Self::stash_action(\n            workspace,\n            \"Drop\",\n            window,\n            cx,\n            async move |repository, sha, stash, commit_view, workspace, cx| {\n                let result = repository.update(cx, |repo, cx| {\n                    if !stash_matches_index(&sha, stash, repo) {\n                        return Err(anyhow::anyhow!(\"Stash has changed, drop aborted\"));\n                    }\n                    Ok(repo.stash_drop(Some(stash), cx))\n                });\n\n                match result {\n                    Ok(task) => task.await??,\n                    Err(err) => {\n                        Self::close_commit_view(commit_view, workspace, cx).await?;\n                        return Err(err);\n                    }\n                };\n                Self::close_commit_view(commit_view, workspace, cx).await?;\n                anyhow::Ok(())\n            },\n        );\n    }\n\n    fn stash_action<AsyncFn>(","sourceCodeStart":816,"sourceCodeEnd":852,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/git_ui/src/commit_view.rs#L816-L852","documentation":"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.","triggerScenarios":"Thrown at crates/git_ui/src/commit_view.rs:834 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Abort the drop and surface a 'stash changed' message","Refresh the stash list in the UI before any further stash mutation","Require the user to confirm against the refreshed list","Treat the mismatch as a safety check, not a git failure"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}