nikivdev/code · error
No diff provided. Pass a diff string, a file path, or '-' to
Error message
No diff provided. Pass a diff string, a file path, or '-' to read stdin.
What it means
Error "No diff provided. Pass a diff string, a file path, or '-' to read stdin." thrown in nikivdev/code.
Source
Thrown at src/changes.rs:176
if let Some(file) = file {
return fs::read_to_string(&file)
.with_context(|| format!("failed to read diff file {}", file.display()));
}
if let Some(raw) = diff {
if raw == "-" {
return read_stdin();
}
let as_path = PathBuf::from(&raw);
if as_path.exists() {
return fs::read_to_string(&as_path)
.with_context(|| format!("failed to read diff file {}", as_path.display()));
}
return Ok(raw);
}
if atty::is(atty::Stream::Stdin) {
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.");View on GitHub (pinned to a747e741ae)
When it happens
Trigger: Thrown at src/changes.rs:176 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/f082b5c66ae5b27b.
Report an issue: GitHub.