influxdata/influxdb · error · ProtoV1ParquetFileError

Error converting compaction level

Error message

Error converting compaction level

What it means

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.

Solutions

  1. Align library versions so the reader's CompactionLevel enum includes all values the writer may emit
  2. Fix or re-write records whose compaction_level discriminant is invalid
  3. Validate the proto field is within the known enum range before conversion

Example fix

// before (proto)
compaction_level: 99 // unknown discriminant
// after
compaction_level: 1 // known CompactionLevel
Defensive patterns

Strategy: validation

Validate before calling

fn compaction_level_known(v: i32) -> bool {
    (0..=MAX_KNOWN_COMPACTION_LEVEL).contains(&v)
}

Try / catch

let pf = ParquetFile::try_from(proto).map_err(|e| match e {
    ProtoV1ParquetFileError::CompactionLevel => anyhow!("unknown compaction level {}", proto.compaction_level),
    other => anyhow!(other),
})?;

Prevention

When it happens

Trigger: 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).

Common situations: Version skew: newer catalog writers emit compaction levels the older reader's enum does not know; corrupted proto bytes yielding an invalid enum discriminant.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19). Data as JSON: /api/errors/284dd34b962bd03b. Report an issue: GitHub.

Appendix: source

Thrown at core/data_types/src/lib.rs:1269

            max_l0_created_at: v.max_l0_created_at.get(),
            source: ParquetFileSource::to_proto(v.source),
        }
    }
}

/// Errors converting from a catalog proto v1 ParquetFile to [`ParquetFile`].
#[derive(Debug, Error)]
pub enum ProtoV1ParquetFileError {
    /// invalid partition hash id
    #[error("Error converting partition_hash_id: {0}")]
    PartitionHashId(#[from] PartitionHashIdError),

    /// invalid object store it
    #[error("Error converting object_store_id: {0}")]
    ObjectStoreId(#[from] uuid::Error),

    /// invalid compaction level
    #[error("Error converting compaction level")]
    CompactionLevel,
}

impl TryFrom<catalog_proto::ParquetFile> for ParquetFile {
    type Error = ProtoV1ParquetFileError;

    fn try_from(v: catalog_proto::ParquetFile) -> Result<Self, Self::Error> {
        Ok(Self {
            id: ParquetFileId::new(v.id),
            namespace_id: NamespaceId::new(v.namespace_id),
            table_id: TableId::new(v.table_id),
            partition_id: PartitionId::new(v.partition_id),
            partition_hash_id: v.partition_hash_id[..].try_into()?,
            object_store_id: ObjectStoreId::from_str(&v.object_store_id)?,
            min_time: Timestamp::new(v.min_time),
            max_time: Timestamp::new(v.max_time),
            to_delete: v.to_delete.map(Timestamp::new),
            file_size_bytes: v.file_size_bytes,

View on GitHub (pinned to 06200ef96b)