{"record":{"id":"eaac40f8b60530dc","repo":"GitoxideLabs/gitoxide","slug":"valid-enrich-ref-eaac40","errorCode":null,"errorMessage":"valid enrich ref","messagePattern":"valid enrich ref","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gix-tix/src/edit/rebase.rs","lineNumber":2358,"sourceCode":"    let mut time = gix::date::parse::TimeBuf::default();\n    let actor = committer.to_ref(&mut time);\n    let commit = repo\n        .new_commit_as(actor, actor, \"Notes copied by tix\", root, parent)\n        .context(\"could not prepare the rewritten Git notes commit\")?\n        .id;\n    Ok(super::stash::RewriteEdits {\n        forward: vec![ref_edit(name.clone(), parent, Some(commit))],\n        rollback: vec![ref_edit(name, Some(commit), parent)],\n    })\n}\n\nfn enrichment_edits(\n    repo: &gix::Repository,\n    object: ObjectId,\n    data: BString,\n    committer: &gix::actor::Signature,\n) -> Result<super::stash::RewriteEdits> {\n    let name: gix::refs::FullName = crate::enrich::REF_NAME.try_into().expect(\"valid enrich ref\");\n    let (root, parent) = match repo.try_find_reference(name.as_ref())? {\n        Some(mut reference) => {\n            let parent = reference\n                .try_id()\n                .context(\"the tix enrich reference must be direct\")?\n                .detach();\n            let root = reference\n                .peel_to_tree()\n                .context(\"could not read the tix enrich tree\")?\n                .id;\n            (root, Some(parent))\n        }\n        None => (ObjectId::empty_tree(repo.object_hash()), None),\n    };\n    let note = repo.write_blob(data)?.detach();\n    let mut state = gix::note::plumbing::State::new(root, repo)\n        .map_err(gix::Exn::into_error)\n        .context(\"could not initialize the tix enrichment tree\")?;","sourceCodeStart":2340,"sourceCodeEnd":2376,"githubUrl":"https://github.com/GitoxideLabs/gitoxide/blob/e73179060badf27222d790981fac3f84c1830a7e/gix-tix/src/edit/rebase.rs#L2340-L2376","documentation":"Panic from converting the hard-coded constant `crate::enrich::REF_NAME` into a `gix::refs::FullName` with `.expect(\"valid enrich ref\")`. The name is a compile-time constant like `refs/tix/enrich`, so conversion failure would mean the shipped constant is malformed — an internal invariant guaranteed by the library authors, never caused by user input.","triggerScenarios":"Any call path into `enrichment_edits` (writing enrichment data during rebase/stash rewrite); the panic fires only if the constant REF_NAME in the crate is not a valid fully-qualified reference name.","commonSituations":"Only reachable in modified or forked builds where `REF_NAME` was edited to a non-fully-qualified name (e.g. missing the `refs/` prefix).","solutions":["If you maintain a fork, ensure `crate::enrich::REF_NAME` is a fully qualified name such as `refs/tix/enrich`.","Restore the original constant if it was customized.","Report upstream if stock builds panic here."],"exampleFix":"// before\npub const REF_NAME: &str = \"tix/enrich\"; // invalid: not fully qualified\n// after\npub const REF_NAME: &str = \"refs/tix/enrich\";","handlingStrategy":"validation","validationCode":"gix::refs::FullName::try_from(crate::enrich::REF_NAME)\n    .map_err(|e| anyhow::anyhow!(\"enrich ref name invalid: {e}\"))?;","typeGuard":"fn valid_enrich_ref(name: &str) -> bool {\n    gix::refs::FullName::try_from(name.to_owned()).is_ok() && name.starts_with(\"refs/\")\n}","tryCatchPattern":null,"preventionTips":["Never edit crate constants like REF_NAME without validating they are fully qualified refs","Keep the refs/ prefix on any custom enrichment reference"],"tags":["rust","panic","internal-invariant","git-refs"],"backgroundTag":"internal-invariant-violation","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"}