{"record":{"id":"90fdc5436ad52746","repo":"nikivdev/code","slug":"diff-input-is-empty","errorCode":null,"errorMessage":"Diff input is empty.","messagePattern":"Diff input is empty\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/changes.rs","lineNumber":194,"sourceCode":"        bail!(\"No diff provided. Pass a diff string, a file path, or '-' to read stdin.\");\n    }\n\n    read_stdin()\n}\n\nfn read_stdin() -> Result<String> {\n    let mut buffer = String::new();\n    io::stdin()\n        .read_to_string(&mut buffer)\n        .context(\"failed to read diff from stdin\")?;\n    Ok(buffer)\n}\n\nfn apply_diff(diff: Option<String>, file: Option<PathBuf>) -> Result<()> {\n    let repo_root = repo_root()?;\n    let content = read_diff_input(diff, file)?;\n    if content.trim().is_empty() {\n        bail!(\"Diff input is empty.\");\n    }\n    trace(&format!(\"applying diff (bytes: {})\", content.len()));\n    apply_diff_content(&repo_root, &content)?;\n\n    println!(\"Applied diff successfully.\");\n    Ok(())\n}\n\nfn apply_diff_content(repo_root: &Path, content: &str) -> Result<()> {\n    let mut child = Command::new(\"git\")\n        .current_dir(repo_root)\n        .args([\"apply\", \"--whitespace=fix\", \"-\"])\n        .stdin(Stdio::piped())\n        .stdout(Stdio::inherit())\n        .stderr(Stdio::inherit())\n        .spawn()\n        .context(\"failed to run git apply\")?;\n","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/changes.rs#L176-L212","documentation":"Error \"Diff input is empty.\" thrown in nikivdev/code.","triggerScenarios":"Thrown at src/changes.rs:194 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}