GitoxideLabs/gitoxide · error

this case should have been removed during processing

Error message

this case should have been removed during processing

What it means

An `unreachable!()` panic in `gix_protocol::handshake::refs::shared::from` while converting internal ref representations into public `Ref` values. `InternalRef::SymbolicForLookup` is a temporary marker expected to be consumed during earlier processing; the panic fires if one survives into the final conversion, meaning the parse/filter pipeline left stale temporary refs behind.

Solutions

  1. Upgrade gix / gix-protocol to the latest version and retry the clone/fetch
  2. Compare behavior against real `git ls-remote` on the same URL; if the advertisement is malformed, fix or avoid the server
  3. File an upstream issue with the server software/version and a capture of the ref advertisement
Defensive patterns

Strategy: try-catch

Try / catch

std::panic::catch_unwind(|| handshake_and_list_refs(conn))
    .map_err(|_| "internal refs-conversion invariant violated; use git ls-remote fallback")?

Prevention

When it happens

Trigger: Calling the handshake refs conversion (`from`) on a v0/v1 or v2 ref advertisement where the earlier `parse_*` stage did not resolve or remove all `SymbolicForLookup` entries — e.g. a remote advertisement with a symbolic ref (like `HEAD`) that the lookup pass failed to process, indicating a bug in the parsing pipeline.

Common situations: Cloning/fetching from servers that advertise symbolic refs in unusual positions or with unusual ordering (custom Git servers, proxies), or using a gix version with an incomplete symbolic-ref resolution step; typically reported as an upstream bug.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of GitoxideLabs/gitoxide@e73179060b (2026-09-08). Data as JSON: /api/errors/145e2eada09438dc. Report an issue: GitHub.

Appendix: source

Thrown at gix-protocol/src/handshake/refs/shared.rs:51

                target: None,
                tag: Some(tag),
                object,
            } => Ref::Peeled {
                full_ref_name: path,
                tag,
                object,
            },
            InternalRef::Peeled { path, tag, object } => Ref::Peeled {
                full_ref_name: path,
                tag,
                object,
            },
            InternalRef::Direct { path, object } => Ref::Direct {
                full_ref_name: path,
                object,
            },
            InternalRef::SymbolicForLookup { .. } => {
                unreachable!("this case should have been removed during processing")
            }
        }
    }
}

#[cfg_attr(test, derive(PartialEq, Eq, Debug, Clone))]
pub(crate) enum InternalRef {
    /// A ref pointing to a `tag` object, which in turns points to an `object`, usually a commit
    Peeled {
        path: BString,
        tag: gix_hash::ObjectId,
        object: gix_hash::ObjectId,
    },
    /// A ref pointing to a commit object
    Direct { path: BString, object: gix_hash::ObjectId },
    /// A symbolic ref pointing to `target` ref, which in turn points to an `object`
    Symbolic {
        path: BString,

View on GitHub (pinned to e73179060b)