nikivdev/code · error

git apply failed

Error message

git apply failed

What it means

Error "git apply failed" thrown in nikivdev/code.

Source

Thrown at src/changes.rs:221

fn apply_diff_content(repo_root: &Path, content: &str) -> Result<()> {
    let mut child = Command::new("git")
        .current_dir(repo_root)
        .args(["apply", "--whitespace=fix", "-"])
        .stdin(Stdio::piped())
        .stdout(Stdio::inherit())
        .stderr(Stdio::inherit())
        .spawn()
        .context("failed to run git apply")?;

    if let Some(mut stdin) = child.stdin.take() {
        stdin
            .write_all(content.as_bytes())
            .context("failed to write diff to git apply")?;
    }

    let status = child.wait().context("failed to wait for git apply")?;
    if !status.success() {
        bail!("git apply failed");
    }

    Ok(())
}

#[derive(Debug, Serialize, Deserialize)]
struct DiffBundle {
    hash: String,
    version: u32,
    created_at: String,
    repo_root: String,
    #[serde(default)]
    project_name: Option<String>,
    base_ref: String,
    diff: String,
    ai_sessions: Vec<serde_json::Value>,
    #[serde(default)]
    env_target: Option<String>,

View on GitHub (pinned to a747e741ae)

When it happens

Trigger: Thrown at src/changes.rs:221 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01). Data as JSON: /api/errors/a18cd6c7ed3d1b07. Report an issue: GitHub.