{"record":{"id":"b8151517b40e13ec","repo":"zed-industries/zed","slug":"git-for-each-ref-failed-with-error","errorCode":null,"errorMessage":"'git for-each-ref' failed with error {:?}","messagePattern":"'git for-each-ref' failed with error (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/git/src/commit.rs","lineNumber":99,"sourceCode":"pub(crate) async fn get_tag_names(\n    git: &GitBinary,\n    shas: &[Oid],\n) -> Result<HashMap<Oid, Vec<String>>> {\n    if shas.is_empty() {\n        return Ok(HashMap::default());\n    }\n\n    let output = git\n        .build_command(&[\n            \"for-each-ref\",\n            \"refs/tags\",\n            \"--sort=-creatordate\",\n            \"--format=%(objectname)%00%(*objectname)%00%(refname:short)\",\n        ])\n        .output()\n        .await\n        .context(\"starting git for-each-ref process\")?;\n    anyhow::ensure!(\n        output.status.success(),\n        \"'git for-each-ref' failed with error {:?}\",\n        String::from_utf8_lossy(&output.stderr)\n    );\n\n    Ok(parse_tag_names(\n        &String::from_utf8_lossy(&output.stdout),\n        shas,\n    ))\n}\n\nfn parse_tag_names(output: &str, shas: &[Oid]) -> HashMap<Oid, Vec<String>> {\n    let shas = shas.iter().copied().collect::<HashSet<_>>();\n    let mut result = HashMap::<Oid, Vec<String>>::default();\n\n    for line in output.lines() {\n        let mut fields = line.split('\\0');\n        let object_sha = fields.next();","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/git/src/commit.rs#L81-L117","documentation":"The 'git for-each-ref refs/tags' subprocess launched successfully but exited with a non-zero status ({error} is the process Output). The repository state, a corrupt refs directory, or a git version issue made tag enumeration fail; the ensure! guard relays the raw output as the failure detail for the tag-names lookup.","triggerScenarios":"Thrown at crates/git/src/commit.rs:99 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Run 'git for-each-ref refs/tags' manually in the repo to see the underlying git error","Check for corrupted refs under .git/refs/tags or a damaged packed-refs file","Propagate with the process's stderr captured so users see git's own diagnosis"],"exampleFix":null,"handlingStrategy":"try-catch","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"}