{"record":{"id":"4350c8c6b2644890","repo":"quickwit-oss/tantivy","slug":"invaliddata-4350c8","errorCode":"InvalidData","errorMessage":"Invalid data","messagePattern":"Invalid data","errorType":"error_code","errorClass":"io::Error","httpStatus":null,"severity":"error","filePath":"columnar/src/lib.rs","lineNumber":71,"sourceCode":"pub type DocId = u32;\n\n#[derive(Clone, Copy, Debug)]\npub struct RowAddr {\n    pub segment_ord: u32,\n    pub row_id: RowId,\n}\n\npub use sstable::{Dictionary, TermOrdHit};\npub type Streamer<'a> = sstable::Streamer<'a, VoidSSTable>;\n\npub use common::DateTime;\n\n#[derive(Copy, Clone, Debug)]\npub struct InvalidData;\n\nimpl From<InvalidData> for io::Error {\n    fn from(_: InvalidData) -> Self {\n        io::Error::new(io::ErrorKind::InvalidData, \"Invalid data\")\n    }\n}\n\n/// Enum describing the number of values that can exist per document\n/// (or per row if you will).\n///\n/// The cardinality must fit on 2 bits.\n#[derive(Clone, Copy, Hash, Default, Debug, PartialEq, Eq, PartialOrd, Ord)]\n#[repr(u8)]\npub enum Cardinality {\n    /// All documents contain exactly one value.\n    /// `Full` is the default for auto-detecting the Cardinality, since it is the most strict.\n    #[default]\n    Full = 0,\n    /// All documents contain at most one value.\n    Optional = 1,\n    /// All documents may contain any number of values.\n    Multivalued = 2,","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/quickwit-oss/tantivy/blob/b5d8deb80c26924e6b007a5b1a7630f35ca64de4/columnar/src/lib.rs#L53-L89","documentation":"columnar defines a unit struct InvalidData whose From<InvalidData> for io::Error builds an io::Error(InvalidData, \"Invalid data\"). Code in the columnar crate uses `?` with this marker to convert internal decode failures (e.g. failed column deserialization) into a generic InvalidData io error. The message is deliberately terse; the real cause is wherever the InvalidData marker was constructed.","triggerScenarios":"Any columnar deserialization path that converts a decode failure via `InvalidData.into()` — e.g. opening a column whose payload doesn't match the expected format (corrupt segment, version mismatch, wrong slice).","commonSituations":"Reading index files written by a different tantivy version; truncated/corrupt segment data; passing non-column bytes to a column-opening API.","solutions":["Validate index file integrity (checksums) before opening columns","Ensure reader and writer use compatible tantivy versions","Re-index the affected segment","Locate the exact failure by catching and logging the io::Error source chain / adding context at call sites"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"fn file_seems_intact(path: &std::path::Path, expected_len: u64) -> bool {\n    std::fs::metadata(path).map(|m| m.len() == expected_len).unwrap_or(false)\n}","typeGuard":null,"tryCatchPattern":"match open_column(bytes) {\n    Err(e) if e.kind() == io::ErrorKind::InvalidData && e.to_string() == \"Invalid data\" => {\n        // treat as corrupt/incompatible segment: verify checksum, reindex or skip\n    }\n    other => other?,\n}","preventionTips":["Verify segment checksums before opening","Use matching tantivy versions for read and write","Wrap deserialization with context so the terse 'Invalid data' points to the real site","Re-index segments after crashes or interrupted writes"],"tags":["io","deserialization","corruption","columnar"],"backgroundTag":"invalid-data","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"}