{"record":{"id":"8bf33d932c7fccce","repo":"influxdata/influxdb","slug":"invalid-iox-metadata","errorCode":null,"errorMessage":"invalid IOx metadata","messagePattern":"invalid IOx metadata","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"core/parquet_file/src/metadata.rs","lineNumber":452,"sourceCode":"            compaction_level: CompactionLevel::Initial,\n            sort_key: None,\n            max_l0_created_at: MaxL0CreatedAt::NotCompacted,\n        }\n    }\n\n    /// Create a corresponding iox catalog's ParquetFile\n    pub fn to_parquet_file<F>(\n        &self,\n        partition_id: PartitionId,\n        partition_hash_id: PartitionHashId,\n        file_size_bytes: u64,\n        metadata: &IoxParquetMetaData,\n        column_id_map: F,\n    ) -> ParquetFileParams\n    where\n        F: for<'a> Fn(&'a str) -> ColumnId,\n    {\n        let decoded = metadata.decode().expect(\"invalid IOx metadata\");\n        trace!(\n            ?partition_id,\n            ?decoded,\n            \"DecodedIoxParquetMetaData decoded from its IoxParquetMetaData\"\n        );\n        let row_count = decoded.row_count();\n        if decoded.md.row_groups().is_empty() {\n            debug!(\n                ?partition_id,\n                \"Decoded IoxParquetMetaData has no row groups to provide useful statistics\"\n            );\n        }\n\n        // Derive the min/max timestamp from the Parquet column statistics.\n        let schema = decoded\n            .read_schema()\n            .expect(\"failed to read encoded schema\");\n        let stats = decoded","sourceCodeStart":434,"sourceCodeEnd":470,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/core/parquet_file/src/metadata.rs#L434-L470","documentation":"This panic occurs in ParquetFileParams::to_parquet_file when metadata.decode() on an IoxParquetMetaData returns None, meaning the parquet file's key-value metadata does not contain valid IOx-specific metadata (the custom serialized Iox metadata expected alongside standard parquet metadata). The code treats that as an unrecoverable invariant and .expect()s with 'invalid IOx metadata'.","triggerScenarios":"Calling to_parquet_file on an IoxParquetMetaData whose embedded KV metadata cannot be decoded — e.g. the file was written by an older/other writer without IOx metadata, or the metadata bytes were corrupted or written by an incompatible version.","commonSituations":"Reading a parquet file created before IOx metadata serialization was introduced; hand-crafted or test parquet files lacking the IOx KV entry; version skew where the decode format changed between releases.","solutions":["Ensure the parquet file was written by a compatible IOx writer version that embeds IoxParquetMetaData","Regenerate/rewrite the affected parquet file (or restore from a compatible backup/catalog snapshot)","If this occurs in tests, build the metadata via the proper writer path instead of constructing raw parquet metadata; file a bug if a supported file hits this"],"exampleFix":"// before\nlet decoded = metadata.decode().expect(\"invalid IOx metadata\");\n// after\nlet decoded = metadata.decode().ok_or_else(|| MetadataError::MissingIoxMetadata { path })?;","handlingStrategy":"try-catch","validationCode":"fn has_iox_metadata(kv: &parquet::format::FileMetaData) -> bool {\n    kv.key_value_metadata.as_ref().map_or(false, |kvs| kvs.iter().any(|kv| kv.key.contains(\"iox\")))\n}","typeGuard":null,"tryCatchPattern":"// it is a panic, so guard before the call:\nif !file_was_written_by_compatible_iox(&path) { return Err(MetadataError::MissingIoxMetadata); }\nlet params = to_parquet_file(&metadata, ...); // safe only for IOx-written files","preventionTips":["Only feed parquet files written by a compatible IOx version into to_parquet_file","Verify the IOx KV metadata entry exists before decoding","Pin reader/writer versions to keep the metadata format aligned; add a decode test against real writer output"],"tags":["rust","parquet","metadata","panic","decode"],"backgroundTag":"unexpected-response-shape","analyzedSha":"06200ef96ba82c5f6727e5038a83af8e722c6875","analyzedAt":"2026-09-19T12:55:30.003Z","contentChangedAt":"2026-09-19T12:55:30.003Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}