{"record":{"id":"3e3fe093e0e90643","repo":"GitoxideLabs/gitoxide","slug":"a-base-object-as-root-of-any-delta-chain-that-we-a","errorCode":null,"errorMessage":"a base object as root of any delta chain that we are here to resolve","messagePattern":"a base object as root of any delta chain that we are here to resolve","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"gix-pack/src/data/file/decode/entry.rs","lineNumber":452,"sourceCode":"        }\n\n        let last_result_size = last_result_size.expect(\"at least one delta chain item\");\n        // uneven chains leave the target buffer after the source buffer\n        // FIXME(Performance) If delta-chains are uneven, we know we will have to copy bytes over here\n        //      Instead we could use a different start buffer, to naturally end up with the result in the\n        //      right one.\n        //      However, this is a bit more complicated than just that - you have to deal with the base\n        //      object, which should also be placed in the second buffer right away. You don't have that\n        //      control/knowledge for out-of-pack bases, so this is a special case to deal with, too.\n        //      Maybe these invariants can be represented in the type system though.\n        if chain_len % 2 == 1 {\n            // this seems inverted, but remember: we swapped the buffers on the last iteration\n            target_buf[..last_result_size].copy_from_slice(&source_buf[..last_result_size]);\n        }\n        debug_assert!(out.len() >= last_result_size);\n        out.truncate(last_result_size);\n\n        let object_kind = object_kind.expect(\"a base object as root of any delta chain that we are here to resolve\");\n        let consumed_input = consumed_input.expect(\"at least one decompressed delta object\");\n        cache.put(\n            self.id,\n            first_entry.data_offset,\n            out.as_slice(),\n            object_kind,\n            consumed_input,\n        );\n        Ok(Outcome {\n            kind: object_kind,\n            // technically depending on the cache, the chain size is not correct as it might\n            // have been cut short by a cache hit. The caller must deactivate the cache to get\n            // actual results\n            num_deltas: chain_len as u32,\n            decompressed_size: first_entry.decompressed_size,\n            compressed_size: consumed_input,\n            object_size: last_result_size as u64,\n        })","sourceCodeStart":434,"sourceCodeEnd":470,"githubUrl":"https://github.com/GitoxideLabs/gitoxide/blob/e73179060badf27222d790981fac3f84c1830a7e/gix-pack/src/data/file/decode/entry.rs#L434-L470","documentation":"A `expect()` panic in `resolve_deltas` asserting that a base object kind is known when caching the resolved object. Any delta chain must terminate in a real object whose kind is tracked; if `object_kind` is `None` at cache-put time, the kind tracking through base resolution failed — an internal invariant of the decoder.","triggerScenarios":"`decode_entry` -> `resolve_deltas` completing a delta chain but having lost the base object's kind (defect in kind propagation from the first entry or resolved base).","commonSituations":"Library development, fuzzing corrupted packs, or custom base-resolution callbacks returning malformed entries.","solutions":["Use stock `resolve_deltas`/decode paths; ensure custom resolve callbacks return well-formed entries","Update gix-pack","Report a reproducer upstream if triggered"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"let r = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| pack.decode_entry(id, &mut out, ...)));\nif r.is_err() { eprintln!(\"delta base kind invariant violated\"); }","preventionTips":["Do not patch internal resolve_deltas logic casually","Keep crate versions in sync","Fuzz findings here should be filed upstream"],"tags":["rust","panic","internal-invariant","gix-pack","delta-resolution"],"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"}