{"record":{"id":"4e2589091462ae8a","repo":"GitoxideLabs/gitoxide","slug":"last-seen-won-t-lie","errorCode":null,"errorMessage":"last seen won't lie","messagePattern":"last seen won't lie","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"gix-pack/src/cache/delta/tree.rs","lineNumber":92,"sourceCode":"    }\n\n    /// Returns self's root and child items.\n    ///\n    /// You can rely on them following the same `children` invariants as they did in the tree\n    pub(super) fn take_root_child_and_refs(self) -> (Vec<Item<T>>, Vec<Item<T>>, RefDeltaChildren) {\n        (self.root_items, self.child_items, self.ref_child_indices)\n    }\n\n    pub(super) fn assert_is_incrementing_and_update_next_offset(\n        &mut self,\n        offset: crate::data::Offset,\n    ) -> Result<(), Error> {\n        let items = match &self.last_seen {\n            Some(NodeKind::Root) => &mut self.root_items,\n            Some(NodeKind::Child) => &mut self.child_items,\n            None => return Ok(()),\n        };\n        let item = &mut items.last_mut().expect(\"last seen won't lie\");\n        if offset <= item.offset {\n            return Err(Error::InvariantIncreasingPackOffset {\n                last_pack_offset: item.offset,\n                pack_offset: offset,\n            });\n        }\n        item.next_offset = offset;\n        Ok(())\n    }\n\n    pub(super) fn set_pack_entries_end_and_resolve_ref_offsets(\n        &mut self,\n        pack_entries_end: crate::data::Offset,\n    ) -> Result<(), traverse::Error> {\n        if !self.future_child_offsets.is_empty() {\n            for (parent_offset, child_index) in self.future_child_offsets.drain(..) {\n                // SAFETY invariants upheld:\n                //  - We are draining from future_child_offsets and adding to children, keeping things the same.","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/GitoxideLabs/gitoxide/blob/e73179060badf27222d790981fac3f84c1830a7e/gix-pack/src/cache/delta/tree.rs#L74-L110","documentation":"A `expect()` panic in `assert_is_incrementing_and_update_next_offset` of the delta tree cache (`gix_pack::cache::delta::Tree`). `last_seen` being `Some` guarantees the corresponding items vec is non-empty (a node was pushed when last_seen was set); `last_mut()` failing means bookkeeping between `last_seen` and the item vecs desynchronized.","triggerScenarios":"Adding pack entries to a `gix_pack::cache::delta::Tree` via `set_pack_entries_end_and_resolve_ref_offsets`, `add_root`, `add_child`, or `add_child_by_id` when internal state was corrupted — practically only via a library defect or misuse of internal mutation APIs.","commonSituations":"Seen in delta-cache development, fuzzing pack indexes with out-of-order offsets (which normally yields a proper `InvariantIncreasingPackOffset` error instead), or inconsistent gix crate versions.","solutions":["Update gix-pack; out-of-order offsets produce a normal error, not this panic","Feed entries in pack-offset order as produced by the pack index","Report a reproducer upstream if triggered"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// entries must be added in strictly increasing pack offsets\n// track previous offset yourself and skip/regress gracefully:\nif offset <= last_offset { return Err(\"non-increasing offset\".into()); }","typeGuard":null,"tryCatchPattern":"let r = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| tree.add_child(...)));\nif r.is_err() { eprintln!(\"delta tree state corrupted\"); }","preventionTips":["Feed pack entries in the order produced by the pack index (increasing offsets)","Use stock gix-pack APIs to populate the delta tree","Report desynchronization panics upstream with the pack"],"tags":["rust","panic","internal-invariant","gix-pack","delta-cache"],"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"}