{"record":{"id":"1fe54eca8c406334","repo":"GitoxideLabs/gitoxide","slug":"bug-forgot-to-implement-chunk","errorCode":null,"errorMessage":"BUG: forgot to implement chunk {:?}","messagePattern":"BUG: forgot to implement chunk (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gix-pack/src/multi_index/write.rs","lineNumber":221,"sourceCode":"            let mut chunk_write = cf\n                .into_write(&mut out, bytes_written)\n                .map_err(gix_hash::io::Error::from)?;\n            while let Some(chunk_to_write) = chunk_write.next_chunk() {\n                match chunk_to_write {\n                    multi_index::chunk::index_names::ID => {\n                        multi_index::chunk::index_names::write(&index_filenames_sorted, &mut chunk_write)\n                    }\n                    multi_index::chunk::fanout::ID => multi_index::chunk::fanout::write(&entries, &mut chunk_write),\n                    multi_index::chunk::lookup::ID => multi_index::chunk::lookup::write(&entries, &mut chunk_write),\n                    multi_index::chunk::offsets::ID => {\n                        multi_index::chunk::offsets::write(&entries, num_large_offsets.is_some(), &mut chunk_write)\n                    }\n                    multi_index::chunk::large_offsets::ID => multi_index::chunk::large_offsets::write(\n                        &entries,\n                        num_large_offsets.expect(\"available if planned\"),\n                        &mut chunk_write,\n                    ),\n                    unknown => unreachable!(\"BUG: forgot to implement chunk {:?}\", std::str::from_utf8(&unknown)),\n                }\n                .map_err(gix_hash::io::Error::from)?;\n                progress.inc();\n                if should_interrupt.load(Ordering::Relaxed) {\n                    return Err(Error::Interrupted);\n                }\n            }\n        }\n\n        // write trailing checksum\n        let multi_index_checksum = out.inner.hash.try_finalize().map_err(gix_hash::io::Error::from)?;\n        out.inner\n            .inner\n            .write_all(multi_index_checksum.as_slice())\n            .map_err(gix_hash::io::Error::from)?;\n        out.progress.show_throughput(write_start);\n\n        Ok(Outcome { multi_index_checksum })","sourceCodeStart":203,"sourceCodeEnd":239,"githubUrl":"https://github.com/GitoxideLabs/gitoxide/blob/e73179060badf27222d790981fac3f84c1830a7e/gix-pack/src/multi_index/write.rs#L203-L239","documentation":"While writing a multi-index (MIDX) file, each planned chunk must have a writer; this panic states a chunk ID was reached for which no write implementation exists — i.e. an internal dispatch gap. It indicates either a corrupt/unknown chunk plan or a chunk type added without implementing its writer.","triggerScenarios":"Calling `write_from_index_paths` (multi-index generation) with a chunk plan containing a chunk ID other than the known ones (pack names, OID fanout/lookup, large offsets) — typically from internal planning logic or a future/unknown chunk id sneaking into the plan.","commonSituations":"Using a gix-pack version mismatch where chunk planning emits IDs the writer doesn't know; hand-built chunk lists; midx format evolution introducing new chunks older code can't write.","solutions":["Upgrade gix-pack so the writer knows all chunk IDs the planner can emit","Ensure only well-known chunk IDs (from gix_pack::multi_index::chunk::*) are planned","If triggered by corrupted input idx files, regenerate the multi-index from valid pack files"],"exampleFix":"// before\nunknown => unreachable!(\"BUG: forgot to implement chunk {:?}\", std::str::from_utf8(&unknown)),\n// after\nunknown => return Err(Error::Io(gix_hash::io::Error::from(std::io::Error::new(\n    std::io::ErrorKind::Unsupported,\n    format!(\"unknown chunk {:?}\", std::str::from_utf8(&unknown)),\n)))),","handlingStrategy":"try-catch","validationCode":"// only plan well-known chunks\nconst KNOWN: [[u8; 4]; 4] = [\n    *b\"PNAM\", *b\"OIDF\", *b\"OIDL\", *b\"OOFF\",\n];\nassert!(chunks.iter().all(|c| KNOWN.contains(c)), \"unknown chunk id in plan\");","typeGuard":null,"tryCatchPattern":"match multi_index::File::write_from_index_paths(paths, progress, should_interrupt) {\n    Ok(f) => f,\n    Err(e) => { log::error!(\"midx write failed: {e}\"); return Err(e.into()); }\n} // panics from unknown chunks cannot be caught without catch_unwind","preventionTips":["Don't construct custom chunk plans; use the library's default planning","Use matching versions of all gix crates (same lockfile/release)","Regenerate multi-index files from valid idx inputs produced by git or gix"],"tags":["rust","multi-index","panic","pack-write"],"backgroundTag":"method-not-implemented","analyzedSha":"e73179060badf27222d790981fac3f84c1830a7e","analyzedAt":"2026-09-08T11:26:50.865Z","contentChangedAt":"2026-09-08T11:26:50.865Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}