{"record":{"id":"284dd34b962bd03b","repo":"influxdata/influxdb","slug":"error-converting-compaction-level","errorCode":null,"errorMessage":"Error converting compaction level","messagePattern":"Error converting compaction level","errorType":"exception","errorClass":"ProtoV1ParquetFileError","httpStatus":null,"severity":"error","filePath":"core/data_types/src/lib.rs","lineNumber":1269,"sourceCode":"            max_l0_created_at: v.max_l0_created_at.get(),\n            source: ParquetFileSource::to_proto(v.source),\n        }\n    }\n}\n\n/// Errors converting from a catalog proto v1 ParquetFile to [`ParquetFile`].\n#[derive(Debug, Error)]\npub enum ProtoV1ParquetFileError {\n    /// invalid partition hash id\n    #[error(\"Error converting partition_hash_id: {0}\")]\n    PartitionHashId(#[from] PartitionHashIdError),\n\n    /// invalid object store it\n    #[error(\"Error converting object_store_id: {0}\")]\n    ObjectStoreId(#[from] uuid::Error),\n\n    /// invalid compaction level\n    #[error(\"Error converting compaction level\")]\n    CompactionLevel,\n}\n\nimpl TryFrom<catalog_proto::ParquetFile> for ParquetFile {\n    type Error = ProtoV1ParquetFileError;\n\n    fn try_from(v: catalog_proto::ParquetFile) -> Result<Self, Self::Error> {\n        Ok(Self {\n            id: ParquetFileId::new(v.id),\n            namespace_id: NamespaceId::new(v.namespace_id),\n            table_id: TableId::new(v.table_id),\n            partition_id: PartitionId::new(v.partition_id),\n            partition_hash_id: v.partition_hash_id[..].try_into()?,\n            object_store_id: ObjectStoreId::from_str(&v.object_store_id)?,\n            min_time: Timestamp::new(v.min_time),\n            max_time: Timestamp::new(v.max_time),\n            to_delete: v.to_delete.map(Timestamp::new),\n            file_size_bytes: v.file_size_bytes,","sourceCodeStart":1251,"sourceCodeEnd":1287,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/core/data_types/src/lib.rs#L1251-L1287","documentation":"Variant of ProtoV1ParquetFileError raised when a v1 catalog protobuf ParquetFile carries a compaction level value that has no valid CompactionLevel representation, so the proto-to-native conversion in From<ProtoV1ParquetFile> fails. It indicates a corrupt or forward-incompatible proto encoding, not bad user input.","triggerScenarios":"Converting a v1 ParquetFile proto whose compaction_level holds a value outside the recognized enum range (e.g. an unknown discriminant from a newer writer).","commonSituations":"Version skew: newer catalog writers emit compaction levels the older reader's enum does not know; corrupted proto bytes yielding an invalid enum discriminant.","solutions":["Align library versions so the reader's CompactionLevel enum includes all values the writer may emit","Fix or re-write records whose compaction_level discriminant is invalid","Validate the proto field is within the known enum range before conversion"],"exampleFix":"// before (proto)\ncompaction_level: 99 // unknown discriminant\n// after\ncompaction_level: 1 // known CompactionLevel","handlingStrategy":"validation","validationCode":"fn compaction_level_known(v: i32) -> bool {\n    (0..=MAX_KNOWN_COMPACTION_LEVEL).contains(&v)\n}","typeGuard":null,"tryCatchPattern":"let pf = ParquetFile::try_from(proto).map_err(|e| match e {\n    ProtoV1ParquetFileError::CompactionLevel => anyhow!(\"unknown compaction level {}\", proto.compaction_level),\n    other => anyhow!(other),\n})?;","preventionTips":["Keep all services on library versions whose CompactionLevel enum includes every emitted value","Never persist compaction level values outside the known enum range","Add a compatibility check when upgrading writers ahead of readers"],"tags":["rust","protobuf","enum","compaction"],"backgroundTag":"invalid-enum-value","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"}