zed-industries/zed · error
Failed to stash staged changes (requires git 2.35 or newer):
Error message
Failed to stash staged changes (requires git 2.35 or newer):
{} What it means
ensure! guard failing when `git stash push --quiet --staged` exits non-zero. The `--staged` flag requires git 2.35+, so it also fires on older git installations where the option is unrecognized; otherwise causes mirror ordinary stash push failures.
Source
Thrown at crates/git/src/repository.rs:2601
.boxed()
}
fn unstage_paths(
&self,
paths: Vec<RepoPath>,
env: Arc<HashMap<String, String>>,
) -> BoxFuture<'_, Result<()>> {
let git = self.git_binary_in_worktree();
self.executor
.spawn(async move {
let git = git?;
if !paths.is_empty() {
let output = git
.build_command(&["reset", "--quiet", "--"])
.envs(env.iter())
.args(paths.iter().map(|p| p.as_std_path()))
.output()
.await?;
anyhow::ensure!(
output.status.success(),
"Failed to unstage:\n{}",
String::from_utf8_lossy(&output.stderr),
);
}
Ok(())
})
.boxed()
}
fn stash_paths(
&self,
paths: Vec<RepoPath>,
message: Option<String>,
env: Arc<HashMap<String, String>>,View on GitHub (pinned to 5a9b9558db)
Solutions
- Detect 'unknown option' or usage errors in stderr and surface a git-version upgrade requirement to the user
- Check `git --version` and gate the feature on >= 2.35
- Handle 'No local changes to save' as a benign no-op
- Clear stale .git/index.lock before retrying
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/git/src/repository.rs:2587 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/487875ad039ab1b1.
Report an issue: GitHub.