{"record":{"id":"17f3c71cfd64f121","repo":"quickwit-oss/tantivy","slug":"unknown-compressor-id-id","errorCode":null,"errorMessage":"unknown compressor id {id:?}","messagePattern":"unknown compressor id (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"src/store/decompressors.rs","lineNumber":40,"sourceCode":"        match compressor {\n            Compressor::None => Decompressor::None,\n            #[cfg(feature = \"lz4-compression\")]\n            Compressor::Lz4 => Decompressor::Lz4,\n            #[cfg(feature = \"zstd-compression\")]\n            Compressor::Zstd(_) => Decompressor::Zstd,\n        }\n    }\n}\n\nimpl Decompressor {\n    pub(crate) fn from_id(id: u8) -> Decompressor {\n        match id {\n            0 => Decompressor::None,\n            #[cfg(feature = \"lz4-compression\")]\n            1 => Decompressor::Lz4,\n            #[cfg(feature = \"zstd-compression\")]\n            4 => Decompressor::Zstd,\n            _ => panic!(\"unknown compressor id {id:?}\"),\n        }\n    }\n\n    pub(crate) fn get_id(&self) -> u8 {\n        match self {\n            Self::None => 0,\n            #[cfg(feature = \"lz4-compression\")]\n            Self::Lz4 => 1,\n            #[cfg(feature = \"zstd-compression\")]\n            Self::Zstd => 4,\n        }\n    }\n\n    pub(crate) fn decompress(&self, compressed_block: &[u8]) -> io::Result<Vec<u8>> {\n        let mut decompressed_block = vec![];\n        self.decompress_into(compressed_block, &mut decompressed_block)?;\n        Ok(decompressed_block)\n    }","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/quickwit-oss/tantivy/blob/b5d8deb80c26924e6b007a5b1a7630f35ca64de4/src/store/decompressors.rs#L22-L58","documentation":"Decompressor::from_id maps the compressor id byte stored in a segment's doc-store footer to a decompression backend (0=None, 1=Lz4, 4=Zstd). Lz4 and Zstd branches only exist when their cargo feature is compiled in, so an id recorded on disk whose codec is unavailable (or a garbage id) hits the panic. It means the segment cannot be decompressed by this build.","triggerScenarios":"Opening a doc store whose footer records compressor id 1 while lz4-compression is disabled, or id 4 while zstd-compression is disabled; reading a segment written by a build with a codec feature this build lacks; a corrupted/newer file with an unknown id byte.","commonSituations":"Writer and reader compiled with different Cargo feature sets; --no-default-features builds silently dropping codec support; index files copied between services with different dependency configs; truncated/hand-edited segment files.","solutions":["Enable the matching codec feature in Cargo.toml (features = [\"lz4-compression\"] or [\"zstd-compression\"]) and rebuild","Align writer and reader builds to the same compression feature set","Re-index or rewrite segments using an available compressor (e.g. None) if the build cannot change","Verify segment file integrity if the id byte itself is corrupt"],"exampleFix":"// before (Cargo.toml)\ntantivy = \"0.22\"\n// after\ntantivy = { version = \"0.22\", features = [\"lz4-compression\", \"zstd-compression\"] }","handlingStrategy":"validation","validationCode":"fn codec_available(id: u8) -> bool {\n    match id {\n        0 => true,\n        1 => cfg!(feature = \"lz4-compression\"),\n        4 => cfg!(feature = \"zstd-compression\"),\n        _ => false,\n    }\n}\n// check footer compressor id before opening: assert!(codec_available(id));","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use identical tantivy feature flags in writer and reader builds","Add CI checks that compare cargo features across services sharing an index","Avoid --no-default-features pruning that drops codec features","Rebuild indexes when changing compression features"],"tags":["rust","compression","feature-flag","panic","data-format"],"backgroundTag":"compression-feature-disabled","analyzedSha":"b5d8deb80c26924e6b007a5b1a7630f35ca64de4","analyzedAt":"2026-09-05T13:20:51.521Z","contentChangedAt":"2026-09-05T13:20:51.521Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}