nikivdev/code · error

Diff input is empty.

Error message

Diff input is empty.

What it means

Error "Diff input is empty." thrown in nikivdev/code.

Source

Thrown at src/changes.rs:194

        bail!("No diff provided. Pass a diff string, a file path, or '-' to read stdin.");
    }

    read_stdin()
}

fn read_stdin() -> Result<String> {
    let mut buffer = String::new();
    io::stdin()
        .read_to_string(&mut buffer)
        .context("failed to read diff from stdin")?;
    Ok(buffer)
}

fn apply_diff(diff: Option<String>, file: Option<PathBuf>) -> Result<()> {
    let repo_root = repo_root()?;
    let content = read_diff_input(diff, file)?;
    if content.trim().is_empty() {
        bail!("Diff input is empty.");
    }
    trace(&format!("applying diff (bytes: {})", content.len()));
    apply_diff_content(&repo_root, &content)?;

    println!("Applied diff successfully.");
    Ok(())
}

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")?;

View on GitHub (pinned to a747e741ae)

When it happens

Trigger: Thrown at src/changes.rs:194 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/90fdc5436ad52746. Report an issue: GitHub.