SeaQL/sea-orm · info

Pushed above

Error message

Pushed above

What it means

In `src/query/loader.rs:1157` (the shared `loader_impl_impl` used by `load_self`, `load_self_many`, `load_self_via`, etc.), the code pushes one `Vec` per input group and then immediately reads `.last_mut().expect("Pushed above")`. The expect documents that a group was just pushed, so `last_mut()` must be `Some`. This is a purely internal invariant; it cannot fire from user input under the current implementation.

Source

Thrown at src/query/loader.rs:1157

        } else {
            output.push(T::default());
        }
    }
    output
}

fn assemble_vectors<I, T: Default>(input: &[Vec<I>], items: Vec<T>) -> Vec<Vec<T>> {
    let mut items = items.into_iter();

    let mut output = Vec::new();

    for input in input.iter() {
        output.push(Vec::new());

        for _inner in input.iter() {
            output
                .last_mut()
                .expect("Pushed above")
                .push(items.next().unwrap_or_default());
        }
    }

    output
}

trait Container: Default + Clone {
    type Item;
    fn add(&mut self, item: Self::Item);
}

impl<T: Clone> Container for Vec<T> {
    type Item = T;
    fn add(&mut self, item: Self::Item) {
        self.push(item);
    }
}

View on GitHub (pinned to e29bcd1b41)

Solutions

  1. No action needed for library users — unreachable in released code.
  2. If hacking on the loader, keep the `output.push(Vec::new())` loop preceding the inner `last_mut()` access intact.
  3. If it fires in a fork, audit any modified grouping/partition logic in `loader_impl_impl`.
Defensive patterns

Strategy: try-catch

Try / catch

// Unreachable; only relevant when patching the loader
if let Some(slot) = output.last_mut() {
    slot.push(items.next().unwrap_or_default());
} else {
    unreachable!("group pushed above");
}

Prevention

When it happens

Trigger: Not reachable through public API — it would require the surrounding grouping loop to be modified so `output` is empty when entries are appended.

Common situations: Only seen when hacking on SeaORM internals or patching the loader implementation itself.

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 SeaQL/sea-orm@e29bcd1b41 (2026-09-10). Data as JSON: /api/errors/33189ede541cd381. Report an issue: GitHub.