zed-industries/zed · error

Failed to stash: {}

Error message

Failed to stash:
{}

What it means

ensure! guard failing when `git stash push --quiet --include-untracked` exits non-zero. The stash was not created; typical causes are no local changes to stash, merge conflicts, or index lock contention.

Source

Thrown at crates/git/src/repository.rs:2574

            .boxed()
    }

    fn stage_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(&["update-index", "--add", "--remove", "--"])
                        .envs(env.iter())
                        .args(paths.iter().map(|p| p.as_unix_str()))
                        .output()
                        .await?;
                    anyhow::ensure!(
                        output.status.success(),
                        "Failed to stage paths:\n{}",
                        String::from_utf8_lossy(&output.stderr),
                    );
                }
                Ok(())
            })
            .boxed()
    }

    fn unstage_paths(
        &self,
        paths: Vec<RepoPath>,
        env: Arc<HashMap<String, String>>,
    ) -> BoxFuture<'_, Result<()>> {
        let git = self.git_binary_in_worktree();

View on GitHub (pinned to 5a9b9558db)

Solutions

  1. Read git stderr from the error ('No local changes to save' is benign — treat as no-op)
  2. Check for .git/index.lock and remove if stale
  3. Ensure no interactive merge state blocks stashing
  4. If a custom message was supplied, verify it doesn't conflict with git argument parsing
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at crates/git/src/repository.rs:2560 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/30d72853cb6bbf72. Report an issue: GitHub.