zed-industries/zed · error
Failed to stash pop: {}
Error message
Failed to stash pop:
{} What it means
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.
Source
Thrown at crates/git/src/repository.rs:2626
);
}
Ok(())
})
.boxed()
}
fn stash_paths(
&self,
paths: Vec<RepoPath>,
message: Option<String>,
env: Arc<HashMap<String, String>>,
) -> BoxFuture<'_, Result<()>> {
let git = self.git_binary_in_worktree();
self.executor
.spawn(async move {
let git = git?;
let mut args = vec!["stash", "push", "--quiet", "--include-untracked"];
if let Some(message) = message.as_deref() {
args.extend_from_slice(&["--message", message]);
}
args.push("--");
let output = git
.build_command(&args)
.envs(env.iter())
.args(paths.iter().map(|p| p.as_unix_str()))
.output()
.await?;
anyhow::ensure!(
output.status.success(),
"Failed to stash:\n{}",
String::from_utf8_lossy(&output.stderr)
);
Ok(())
})
.boxed()View on GitHub (pinned to 5a9b9558db)
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
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at crates/git/src/repository.rs:2612 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of zed-industries/zed@5a9b9558db (2026-08-20).
Data as JSON: /api/errors/33d9d8796a989202.
Report an issue: GitHub.