zed-industries/zed · error
Failed to apply uncommitted diff patch with status: {} stder
Error message
Failed to apply uncommitted diff patch with status: {}
stderr:
{}
stdout:
{} What it means
setup_worktree pipes the example's uncommitted diff into `git apply -` and the apply process exited with the reported status; the embedded stderr shows why the patch did not fit the checked-out worktree (conflict, corrupt diff, or path prefix mismatch).
Source
Thrown at crates/edit_prediction_cli/src/load_project.rs:374
step_progress.set_substatus("applying diff");
// old examples had full paths in the uncommitted diff.
let uncommitted_diff =
strip_diff_path_prefix(&example.spec.uncommitted_diff, &repo_name.name);
let mut apply_process = smol::process::Command::new("git")
.current_dir(&worktree_path)
.args(&["apply", "-"])
.stdin(std::process::Stdio::piped())
.spawn()?;
let mut stdin = apply_process.stdin.take().context("Failed to get stdin")?;
stdin.write_all(uncommitted_diff.as_bytes()).await?;
stdin.close().await?;
drop(stdin);
let apply_result = apply_process.output().await?;
anyhow::ensure!(
apply_result.status.success(),
"Failed to apply uncommitted diff patch with status: {}\nstderr:\n{}\nstdout:\n{}",
apply_result.status,
String::from_utf8_lossy(&apply_result.stderr),
String::from_utf8_lossy(&apply_result.stdout),
);
}
step_progress.clear_substatus();
Ok(worktree_path)
}
async fn apply_edit_history(
example: &Example,
project: &Entity<Project>,
cx: &mut AsyncApp,
) -> Result<OpenedBuffers> {
edit_prediction::udiff::apply_diff(&example.spec.edit_history, project, cx).awaitView on GitHub (pinned to f4178619ac)
Solutions
- Check the embedded stderr for git apply's conflict details
- Regenerate the example/diff against the matching commit
- Ensure the worktree is at the expected base commit before applying
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at crates/edit_prediction_cli/src/load_project.rs:374 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20).
Data as JSON: /api/errors/1bafaea009876f44.
Report an issue: GitHub.