influxdata/influxdb · error · ProtoV1AnyWithStorageError

Error converting max_tables

Error message

Error converting max_tables: {0}

What it means

ProtoV1AnyWithStorageError::MaxTables is raised when converting a catalog-storage proto v1 NamespaceWithStorage or TableWithStorage into the native NamespaceWithStorage/TableWithStorage type, and the proto's max_tables field cannot be converted into the internal ServiceLimit-bounded representation (e.g. value out of the allowed limit range).

Solutions

  1. Inspect the proto's max_tables value and correct it to a value within the current ServiceLimit range
  2. Update/repair the stored catalog object so it conforms to current limit rules
  3. If limits changed across versions, migrate old stored values to the new valid range before conversion

Example fix

// before (proto)
max_tables: 999999999 // exceeds service limit
// after
max_tables: 5000 // within ServiceLimit bounds
Defensive patterns

Strategy: validation

Validate before calling

fn max_tables_valid(v: i64, limit: i64) -> bool {
    v > 0 && v <= limit
}

Try / catch

let ns = NamespaceWithStorage::try_from(proto).map_err(|e| match e {
    ProtoV1AnyWithStorageError::MaxTables(src) => anyhow!("bad max_tables: {}", src),
    other => anyhow!(other),
})?;

Prevention

When it happens

Trigger: Deserializing a v1 catalog-storage proto whose max_tables value fails ServiceLimitError validation — typically a value exceeding the permitted service limit or otherwise unrepresentable.

Common situations: Catalog data written by another version or tool with out-of-range max_tables; hand-edited or corrupted proto payloads; limits changed between versions so previously valid stored values no longer parse.

Understand the failure class

Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.

Related errors


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

Appendix: source

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

            id: value.id.get(),
            name: value.name,
            retention_period_ns: value.retention_period_ns,
            max_tables: value.max_tables.get_i32(),
            max_columns_per_table: value.max_columns_per_table.get_i32(),
            partition_template: value.partition_template.as_proto().cloned(),
            size_bytes: value.size_bytes,
            table_count: value.table_count as i32,
            deleted_at: value.deleted_at.map(google::Timestamp::from),
        }
    }
}

/// Errors converting from a catalog_storage proto v1 NamespaceWithStorage or TableWithStorage to
/// [`NamespaceWithStorage`] or [`TableWithStorage`].
#[derive(Debug, Error)]
pub enum ProtoV1AnyWithStorageError {
    /// invalid value for MaxTables
    #[error("Error converting max_tables: {0}")]
    MaxTables(ServiceLimitError),

    /// invalid value for MaxColumnsPerTable
    #[error("Error converting max_columns_per_table: {0}")]
    MaxColumnsPerTable(ServiceLimitError),

    /// invalid value for PartitionTemplate
    #[error("Error converting partition_template: {0}")]
    PartitionTemplate(ValidationError),
}

impl TryFrom<catalog_storage_proto::NamespaceWithStorage> for NamespaceWithStorage {
    type Error = ProtoV1AnyWithStorageError;

    /// We require fallible conversion because generated protobuf structs can carry any i32
    /// value for `max_tables` and `max_columns_per_table`, which is larger than the domain
    /// `MaxTables` and `MaxColumnsPerTable` can represent (i.e. 0..=i32::MAX).
    /// The `partition_template` can also be invalid.

View on GitHub (pinned to 06200ef96b)