{"record":{"id":"99eb5afa8c2a4805","repo":"zed-industries/zed","slug":"failed-to-stash-drop","errorCode":null,"errorMessage":"Failed to stash drop:\n{}","messagePattern":"Failed to stash drop:\n(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/git/src/repository.rs","lineNumber":2676,"sourceCode":"                let mut args = vec![\"stash\", \"push\", \"--quiet\", \"--staged\"];\n                if let Some(message) = message.as_deref() {\n                    args.extend_from_slice(&[\"--message\", message]);\n                }\n                let output = git.build_command(&args).envs(env.iter()).output().await?;\n\n                anyhow::ensure!(\n                    output.status.success(),\n                    \"Failed to stash staged changes (requires git 2.35 or newer):\\n{}\",\n                    String::from_utf8_lossy(&output.stderr)\n                );\n                Ok(())\n            })\n            .boxed()\n    }\n\n    fn stash_pop(\n        &self,\n        index: Option<usize>,\n        env: Arc<HashMap<String, String>>,\n    ) -> BoxFuture<'_, Result<()>> {\n        let git = self.git_binary_in_worktree();\n        self.executor\n            .spawn(async move {\n                let git = git?;\n                let mut args = vec![\"stash\".to_string(), \"pop\".to_string()];\n                if let Some(index) = index {\n                    args.push(format!(\"stash@{{{}}}\", index));\n                }\n                let output = git.build_command(&args).envs(env.iter()).output().await?;\n\n                anyhow::ensure!(\n                    output.status.success(),\n                    \"Failed to stash pop:\\n{}\",\n                    String::from_utf8_lossy(&output.stderr)\n                );\n                Ok(())","sourceCodeStart":2658,"sourceCodeEnd":2694,"githubUrl":"https://github.com/zed-industries/zed/blob/5a9b9558db01a6b906cec2fb70a797affdc58cdd/crates/git/src/repository.rs#L2658-L2694","documentation":"Repository::stash_drop runs `git stash drop` and fails when the command exits non-zero — typically because the given stash index does not exist or the stash list is empty. The git stderr is embedded in the message.","triggerScenarios":"Thrown at crates/git/src/repository.rs:2662 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Treat 'stash@{N}: Could not drop' style errors as the entry already being gone and refresh the stash list","Validate the index against a current `git stash list` before dropping","If the entry is confirmed absent, update UI state instead of retrying","Log stderr for unexpected failures like index corruption"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5a9b9558db01a6b906cec2fb70a797affdc58cdd","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}