{"record":{"id":"af30defeb4990b29","repo":"zed-industries/zed","slug":"raw-diff-is-missing-the-path","errorCode":null,"errorMessage":"raw diff is missing the path","messagePattern":"raw diff is missing the path","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/git/src/commit.rs","lineNumber":192,"sourceCode":"    pub status: StatusCode,\n    pub old_object: Option<CommitDiffObject<'a>>,\n    pub new_object: Option<CommitDiffObject<'a>>,\n}\n\n/// Parses the output of `git diff --raw --no-abbrev -z`.\npub(crate) fn parse_git_diff_raw(\n    content: &str,\n) -> impl Iterator<Item = Result<CommitDiffEntry<'_>>> {\n    let mut parts = content.split('\\0');\n    std::iter::from_fn(move || {\n        let metadata = parts.next()?;\n        if metadata.is_empty() {\n            return None;\n        }\n\n        let path = match parts.next() {\n            Some(path) => path,\n            None => return Some(Err(anyhow::anyhow!(\"raw diff is missing the path\"))),\n        };\n        Some(parse_git_diff_raw_entry(metadata, path))\n    })\n}\n\nfn parse_git_diff_raw_entry<'a>(metadata: &'a str, path: &'a str) -> Result<CommitDiffEntry<'a>> {\n    let mut fields = metadata\n        .strip_prefix(':')\n        .context(\"raw diff metadata is missing its ':' prefix\")?\n        .split_ascii_whitespace();\n    let old_mode = fields.next().context(\"raw diff is missing the old mode\")?;\n    let new_mode = fields.next().context(\"raw diff is missing the new mode\")?;\n    let old_oid = fields\n        .next()\n        .context(\"raw diff is missing the old object ID\")?;\n    let new_oid = fields\n        .next()\n        .context(\"raw diff is missing the new object ID\")?;","sourceCodeStart":174,"sourceCodeEnd":210,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/git/src/commit.rs#L174-L210","documentation":"While parsing 'git diff --raw -z' output, a metadata entry was followed by end-of-input instead of the expected path component — each raw diff entry is a NUL-separated (metadata, path) pair, and the parser hit EOF after reading metadata. This indicates truncated or malformed git output (e.g. a killed process or partial pipe read), so the affected entry is rejected.","triggerScenarios":"Thrown at crates/git/src/commit.rs:192 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check that the git process produced complete output (no early termination or partial pipe capture)","Re-run the diff to obtain a complete output stream","Add a regression test with truncated input to keep the parser's malformed-input behavior intentional"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}