{"record":{"id":"2d6f7b08ff68648c","repo":"GitoxideLabs/gitoxide","slug":"no-item-index-implies-having-an-object-id","errorCode":null,"errorMessage":"no item index implies having an object id","messagePattern":"no item index implies having an object id","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gix-protocol/src/fetch/refmap/init.rs","lineNumber":76,"sourceCode":"            .match_lhs(remote_refs.iter().map(|r| {\n                let (full_ref_name, target, object) = r.unpack();\n                gix_refspec::match_group::Item {\n                    full_ref_name,\n                    target: target.unwrap_or(&null),\n                    object,\n                }\n            }))\n            .validated()?;\n\n        let mappings = res.mappings;\n        let mappings = mappings\n            .into_iter()\n            .map(|m| Mapping {\n                remote: m.item_index.map_or_else(\n                    || {\n                        Source::ObjectId(match m.lhs {\n                            gix_refspec::match_group::SourceRef::ObjectId(id) => id,\n                            _ => unreachable!(\"no item index implies having an object id\"),\n                        })\n                    },\n                    |idx| Source::Ref(remote_refs[idx].clone()),\n                ),\n                local: m.rhs.map(std::borrow::Cow::into_owned),\n                spec_index: if m.spec_index < num_explicit_specs {\n                    SpecIndex::ExplicitInRemote(m.spec_index)\n                } else {\n                    SpecIndex::Implicit(m.spec_index - num_explicit_specs)\n                },\n            })\n            .collect();\n\n        Ok(Self {\n            mappings,\n            refspecs: fetch_refspecs,\n            extra_refspecs,\n            fixes,","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/GitoxideLabs/gitoxide/blob/e73179060badf27222d790981fac3f84c1830a7e/gix-protocol/src/fetch/refmap/init.rs#L58-L94","documentation":"An `unreachable!()` panic in gix-protocol's fetch ref-mapping initialization. When building `Mapping` values, a refspec match with no `item_index` is expected to always resolve to an object-id source; the panic fires if the matched `SourceRef` is anything other than `ObjectId` in that case. It marks a broken invariant between the refspec match group results and the mapping construction.","triggerScenarios":"Running `git fetch` (via gix fetch handshake/refmap init) against a remote whose advertised refs lead the refspec matcher to produce a match with `item_index == None` but a non-`ObjectId` `lhs` source — e.g. a malformed or adversarial remote ref advertisement, or a bug in `gix-refspec` match-group logic.","commonSituations":"Fetching from a remotes URL with unusual or hand-crafted ref advertisement (refs pointing at tags/symbolic entries where objects are expected), or using a refspec configuration that the matcher resolves inconsistently; most often surfaced as a gix bug report rather than a user error.","solutions":["Check the remote ref advertisement for malformed entries (`git ls-remote <url>`) and fix/replace the remote if it serves invalid data","Simplify the fetch refspec in `.git/config` (use explicit `+refs/heads/*:refs/remotes/origin/*` style) and retry","Upgrade gix / gix-protocol and gix-refspec — the panic signals a crate-level invariant bug to report upstream with the remote URL and refspec"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// validate the remote advertisement before fetching\nlet advertised = repo.remote_at(\"origin\")?.refspecs()?.iter().count();\nif advertised == 0 { return Err(\"no refspecs configured for fetch\".into()); }","typeGuard":"fn expects_object_id(m: &Mapping) -> bool { m.item_index.is_none() }","tryCatchPattern":"std::panic::catch_unwind(|| perform_fetch(repo, specs))\n    .map_err(|_| \"gix fetch hit an internal refmap invariant; retry with plain git fetch\")?","preventionTips":["Keep fetch refspecs in standard +refs/heads/*:refs/remotes/origin/* form","Verify suspicious remotes with `git ls-remote` before automated fetching","Keep gix, gix-protocol and gix-refspec versions in sync from the same release","Avoid pointing fetches at non-git or adversarially-crafted ref advertisements"],"tags":["rust","panic","fetch","refs","protocol"],"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"}