{"record":{"id":"f51803008d3452ea","repo":"quickwit-oss/quickwit","slug":"invalid-split-recovery-metadata-magic-number","errorCode":null,"errorMessage":"invalid split recovery metadata magic number","messagePattern":"invalid split recovery metadata magic number","errorType":"exception","errorClass":"io::Error (InvalidData)","httpStatus":null,"severity":"error","filePath":"quickwit/quickwit-proto/src/metastore/mod.rs","lineNumber":62,"sourceCode":"        use prost::Message;\n\n        let mut output =\n            Vec::with_capacity(SPLIT_RECOVERY_METADATA_HEADER_LEN + self.encoded_len());\n        output.extend_from_slice(SPLIT_RECOVERY_METADATA_MAGIC);\n        output.push(SPLIT_RECOVERY_METADATA_FORMAT_VERSION);\n        self.encode(&mut output)\n            .expect(\"encoding a protobuf into a Vec should not fail\");\n        output\n    }\n\n    /// Deserializes split recovery metadata embedded in a split bundle.\n    pub fn deserialize(mut bytes: &[u8]) -> io::Result<Self> {\n        use prost::Message;\n\n        if bytes.len() < SPLIT_RECOVERY_METADATA_HEADER_LEN\n            || &bytes[..SPLIT_RECOVERY_METADATA_MAGIC.len()] != SPLIT_RECOVERY_METADATA_MAGIC\n        {\n            return Err(io::Error::new(\n                io::ErrorKind::InvalidData,\n                \"invalid split recovery metadata magic number\",\n            ));\n        }\n        let version = bytes[SPLIT_RECOVERY_METADATA_MAGIC.len()];\n        if version != SPLIT_RECOVERY_METADATA_FORMAT_VERSION {\n            return Err(io::Error::new(\n                io::ErrorKind::InvalidData,\n                format!(\"unsupported split recovery metadata format version: {version}\"),\n            ));\n        }\n        bytes = &bytes[SPLIT_RECOVERY_METADATA_HEADER_LEN..];\n        Self::decode(bytes).map_err(|error| io::Error::new(io::ErrorKind::InvalidData, error))\n    }\n}\n\n#[cfg(test)]\nmod split_recovery_metadata_tests {","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/quickwit-oss/quickwit/blob/a39730c5cdcd1a4fe798403737ae293999ea21f8/quickwit/quickwit-proto/src/metastore/mod.rs#L44-L80","documentation":"`SplitRecoveryMetadata::deserialize` expects a byte blob starting with a fixed magic header (SPLIT_RECOVERY_METADATA_MAGIC) of at least header length. If the bytes are too short or the magic does not match, the data is not split recovery metadata in the expected envelope format, so it fails with InvalidData.","triggerScenarios":"Calling SplitRecoveryMetadata::deserialize on bytes produced by an older format (no magic header), on entirely unrelated bytes, or on a file read at the wrong offset.","commonSituations":"Upgrading Quickwit over a metastore/object store that still holds pre-magic-format blobs; hand-editing or truncating recovery metadata files; deserializing the wrong payload from a queue or file.","solutions":["Confirm the bytes being passed actually come from SplitRecoveryMetadata::serialize.","Delete or re-generate stale recovery metadata written by an older Quickwit version.","Check the code path that produced the blob for offset/concatenation mistakes.","Use matching Quickwit versions across the cluster so all nodes write the same envelope format."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"fn looks_like_recovery_metadata(bytes: &[u8]) -> bool {\n    bytes.len() > 5 && &bytes[..5] == b\"QWSRM\" // header length >= magic len\n}","typeGuard":null,"tryCatchPattern":"match SplitRecoveryMetadata::deserialize(&bytes) {\n    Ok(meta) => handle(meta),\n    Err(e) if e.kind() == std::io::ErrorKind::InvalidData => {\n        // legacy or foreign payload: regenerate or discard\n        log::warn!(\"bad recovery metadata envelope: {e}\");\n    }\n    Err(e) => return Err(e.into()),\n}","preventionTips":["Only deserialize blobs produced by SplitRecoveryMetadata::serialize from the same Quickwit version.","Clean up legacy metadata left by older releases before upgrading.","Avoid hand-editing or truncating serialized metadata files."],"tags":["io","serialization","protobuf","invalid-data"],"backgroundTag":"checksum-mismatch","analyzedSha":"a39730c5cdcd1a4fe798403737ae293999ea21f8","analyzedAt":"2026-09-08T13:19:37.784Z","contentChangedAt":"2026-09-08T13:19:37.784Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}