{"record":{"id":"6073b2f50eceba20","repo":"GitoxideLabs/gitoxide","slug":"review-commit-names-an-invalid-review-reference","errorCode":null,"errorMessage":"review commit names an invalid review reference","messagePattern":"review commit names an invalid review reference","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gix-tix/src/edit/review.rs","lineNumber":44,"sourceCode":"\npub(crate) enum Finish {\n    Complete(Finished),\n    Conflict(super::rebase::Conflict),\n    SelectReturn { tip: ObjectId },\n}\n\npub(crate) fn reference(commit: &gix::objs::Commit) -> Result<Option<gix::refs::FullName>> {\n    commit\n        .extra_headers\n        .iter()\n        .find_map(|(name, value)| {\n            (name.as_slice() == HEADER)\n                .then(|| value.as_slice().strip_prefix(ONTO))\n                .flatten()\n        })\n        .map(|name| {\n            if history::review_number(name.as_bstr()).is_none() {\n                anyhow::bail!(\"review commit names an invalid review reference\");\n            }\n            BString::from(name)\n                .try_into()\n                .context(\"review commit names an invalid reference\")\n        })\n        .transpose()\n}\n\npub(crate) fn is_review(commit: &gix::objs::Commit) -> bool {\n    reference(commit).ok().flatten().is_some()\n}\n\npub(super) fn return_to(commit: &gix::objs::Commit) -> Result<Option<gix::refs::FullName>> {\n    commit\n        .extra_headers\n        .iter()\n        .find(|(name, _)| name.as_slice() == RETURN_TO)\n        .map(|(_, value)| {","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/GitoxideLabs/gitoxide/blob/e73179060badf27222d790981fac3f84c1830a7e/gix-tix/src/edit/review.rs#L26-L62","documentation":"When loading a review from commit headers, a header naming an `ONTO`/review reference is validated with `history::review_number(name)`. If the referenced name does not parse as a valid numbered review reference, the review commit is considered malformed and the load fails with this message (a follow-up `.context(\"review commit names an invalid reference\")` wraps the conversion error).","triggerScenarios":"Decoding a review commit whose `HEADER` metadata value has an `ONTO` prefix, but the resulting name has no valid review number (`history::review_number(name.as_bstr()).is_none()`) — raised from `review()` and transitively from `deletions`/`finish_with_progress`.","commonSituations":"Hand-edited or corrupted review commit messages; reviews written by an older/incompatible gix-tix version whose reference naming scheme differs; cherry-picked review commits whose metadata no longer matches existing refs.","solutions":["Delete/recreate the malformed review commit so fresh, valid metadata is written.","Fix the review reference name in the commit message to match the expected numbered format.","Verify the repository's review refs exist and follow the current naming scheme used by `history::review_number`.","Skip or prune stale review commits imported from older tool versions."],"exampleFix":"// before: trusting a corrupt review header\nlet review = edit::review::review(repo, commit_id)?; // bails\n// after: validate the reference first\nlet name = extract_onto_name(repo, commit_id)?;\nif history::review_number(&name).is_none() {\n    recreate_review(repo, commit_id)?; // rewrite valid metadata\n}\nlet review = edit::review::review(repo, commit_id)?;","handlingStrategy":"validation","validationCode":"if let Some(name) = extract_onto_name(review_commit)? {\n    if history::review_number(&name).is_none() {\n        // recreate the review or fix its metadata before loading\n    }\n}\n","typeGuard":"fn has_valid_review_ref(name: &BStr) -> bool {\n    history::review_number(name).is_some()\n}\n","tryCatchPattern":null,"preventionTips":["Never hand-edit review commit metadata","Recreate reviews after cherry-picking them across repositories","Validate review refs against the current naming scheme after tool upgrades"],"tags":["review","metadata-validation","git"],"backgroundTag":"invalid-identifier-format","analyzedSha":"e73179060badf27222d790981fac3f84c1830a7e","analyzedAt":"2026-09-08T11:26:50.865Z","contentChangedAt":"2026-09-08T11:26:50.865Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}