{"record":{"id":"33d9d8796a989202","repo":"zed-industries/zed","slug":"failed-to-stash-pop","errorCode":null,"errorMessage":"Failed to stash pop:\n{}","messagePattern":"Failed to stash pop:\n(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/git/src/repository.rs","lineNumber":2626,"sourceCode":"                    );\n                }\n                Ok(())\n            })\n            .boxed()\n    }\n\n    fn stash_paths(\n        &self,\n        paths: Vec<RepoPath>,\n        message: Option<String>,\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\", \"push\", \"--quiet\", \"--include-untracked\"];\n                if let Some(message) = message.as_deref() {\n                    args.extend_from_slice(&[\"--message\", message]);\n                }\n                args.push(\"--\");\n                let output = git\n                    .build_command(&args)\n                    .envs(env.iter())\n                    .args(paths.iter().map(|p| p.as_unix_str()))\n                    .output()\n                    .await?;\n\n                anyhow::ensure!(\n                    output.status.success(),\n                    \"Failed to stash:\\n{}\",\n                    String::from_utf8_lossy(&output.stderr)\n                );\n                Ok(())\n            })\n            .boxed()","sourceCodeStart":2608,"sourceCodeEnd":2644,"githubUrl":"https://github.com/zed-industries/zed/blob/5a9b9558db01a6b906cec2fb70a797affdc58cdd/crates/git/src/repository.rs#L2608-L2644","documentation":"ensure! guard failing when `git stash pop [stash@{N}]` exits non-zero. The stash entry is not removed and changes not applied, typically because applying conflicts with the working tree or the requested stash index no longer exists.","triggerScenarios":"Thrown at crates/git/src/repository.rs:2612 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check stderr for merge conflicts; if conflicts occurred, tell the user to resolve them — the stash entry is preserved","Validate the requested index still exists via `git stash list` before popping","Abort pop when the stash list has shifted (see stash_matches_index style checks)","Suggest `git stash apply` instead, which keeps the entry for retry"],"exampleFix":null,"handlingStrategy":"try-catch","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-14T00:17:10.932Z"}