zed-industries/zed · error
Failed to stash drop: {}
Error message
Failed to stash drop:
{} What it means
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.
Source
Thrown at crates/git/src/repository.rs:2676
let mut args = vec!["stash", "push", "--quiet", "--staged"];
if let Some(message) = message.as_deref() {
args.extend_from_slice(&["--message", message]);
}
let output = git.build_command(&args).envs(env.iter()).output().await?;
anyhow::ensure!(
output.status.success(),
"Failed to stash staged changes (requires git 2.35 or newer):\n{}",
String::from_utf8_lossy(&output.stderr)
);
Ok(())
})
.boxed()
}
fn stash_pop(
&self,
index: Option<usize>,
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".to_string(), "pop".to_string()];
if let Some(index) = index {
args.push(format!("stash@{{{}}}", index));
}
let output = git.build_command(&args).envs(env.iter()).output().await?;
anyhow::ensure!(
output.status.success(),
"Failed to stash pop:\n{}",
String::from_utf8_lossy(&output.stderr)
);
Ok(())View on GitHub (pinned to 5a9b9558db)
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
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/git/src/repository.rs:2662 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/99eb5afa8c2a4805.
Report an issue: GitHub.