GitoxideLabs/gitoxide · info

just added

Error message

just added

What it means

`id_for_macro` inserts a new metadata entry for the macro name, then does `self.name_to_meta.get_mut(name).expect("just added")`. Because the insert precedes the lookup in the same function, None is impossible unless the insert silently failed or the name key diverged between insert and lookup.

Solutions

  1. No user-side action; treat occurrence as a crate bug and report it
  2. Rebuild with unmodified upstream gix-attributes sources
  3. Keep gix-attributes and gix-glob versions in lockstep
Defensive patterns

Strategy: try-catch

Try / catch

std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| collection.update_from_list(&list)));

Prevention

When it happens

Trigger: Only reachable through `update_from_list` processing a macro pattern; would fire if the inserted key differs from the looked-up `name` (refactor regression) or allocator corruption — not from user input.

Common situations: Effectively never observed by users; may appear in fuzz runs or after manual edits to the crate internals.

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/c3aa67d7e4b75c8a. Report an issue: GitHub.

Appendix: source

Thrown at gix-attributes/src/search/outcome.rs:316

        let order = match self.name_to_meta.get_mut(name) {
            Some(meta) => meta.id,
            None => {
                let order = AttributeId(self.name_to_meta.len());
                self.name_to_meta.insert(
                    NameRef(name).to_owned(),
                    Metadata {
                        id: order,
                        macro_attributes: Default::default(),
                    },
                );
                order
            }
        };

        self.assign_order_to_attributes(attrs);
        self.name_to_meta
            .get_mut(name)
            .expect("just added")
            .macro_attributes
            .clone_from(attrs);

        order
    }
    pub(crate) fn id_for_attribute(&mut self, name: &str) -> AttributeId {
        match self.name_to_meta.get(name) {
            Some(meta) => meta.id,
            None => {
                let order = AttributeId(self.name_to_meta.len());
                self.name_to_meta.insert(NameRef(name).to_owned(), order.into());
                order
            }
        }
    }
    pub(crate) fn assign_order_to_attributes(&mut self, attributes: &mut [TrackedAssignment]) {
        for TrackedAssignment {
            id: order,

View on GitHub (pinned to e73179060b)