{"record":{"id":"967a81306e6643b0","repo":"influxdata/influxdb","slug":"error-converting-max-tables-0","errorCode":null,"errorMessage":"Error converting max_tables: {0}","messagePattern":"Error converting max_tables: (.+?)","errorType":"exception","errorClass":"ProtoV1AnyWithStorageError","httpStatus":null,"severity":"error","filePath":"core/data_types/src/lib.rs","lineNumber":472,"sourceCode":"            id: value.id.get(),\n            name: value.name,\n            retention_period_ns: value.retention_period_ns,\n            max_tables: value.max_tables.get_i32(),\n            max_columns_per_table: value.max_columns_per_table.get_i32(),\n            partition_template: value.partition_template.as_proto().cloned(),\n            size_bytes: value.size_bytes,\n            table_count: value.table_count as i32,\n            deleted_at: value.deleted_at.map(google::Timestamp::from),\n        }\n    }\n}\n\n/// Errors converting from a catalog_storage proto v1 NamespaceWithStorage or TableWithStorage to\n/// [`NamespaceWithStorage`] or [`TableWithStorage`].\n#[derive(Debug, Error)]\npub enum ProtoV1AnyWithStorageError {\n    /// invalid value for MaxTables\n    #[error(\"Error converting max_tables: {0}\")]\n    MaxTables(ServiceLimitError),\n\n    /// invalid value for MaxColumnsPerTable\n    #[error(\"Error converting max_columns_per_table: {0}\")]\n    MaxColumnsPerTable(ServiceLimitError),\n\n    /// invalid value for PartitionTemplate\n    #[error(\"Error converting partition_template: {0}\")]\n    PartitionTemplate(ValidationError),\n}\n\nimpl TryFrom<catalog_storage_proto::NamespaceWithStorage> for NamespaceWithStorage {\n    type Error = ProtoV1AnyWithStorageError;\n\n    /// We require fallible conversion because generated protobuf structs can carry any i32\n    /// value for `max_tables` and `max_columns_per_table`, which is larger than the domain\n    /// `MaxTables` and `MaxColumnsPerTable` can represent (i.e. 0..=i32::MAX).\n    /// The `partition_template` can also be invalid.","sourceCodeStart":454,"sourceCodeEnd":490,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/core/data_types/src/lib.rs#L454-L490","documentation":"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).","triggerScenarios":"Deserializing a v1 catalog-storage proto whose max_tables value fails ServiceLimitError validation — typically a value exceeding the permitted service limit or otherwise unrepresentable.","commonSituations":"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.","solutions":["Inspect the proto's max_tables value and correct it to a value within the current ServiceLimit range","Update/repair the stored catalog object so it conforms to current limit rules","If limits changed across versions, migrate old stored values to the new valid range before conversion"],"exampleFix":"// before (proto)\nmax_tables: 999999999 // exceeds service limit\n// after\nmax_tables: 5000 // within ServiceLimit bounds","handlingStrategy":"validation","validationCode":"fn max_tables_valid(v: i64, limit: i64) -> bool {\n    v > 0 && v <= limit\n}","typeGuard":null,"tryCatchPattern":"let ns = NamespaceWithStorage::try_from(proto).map_err(|e| match e {\n    ProtoV1AnyWithStorageError::MaxTables(src) => anyhow!(\"bad max_tables: {}\", src),\n    other => anyhow!(other),\n})?;","preventionTips":["Clamp max_tables to the service limit before writing catalog protos","Keep writer and reader library versions in sync with current limit rules","Alert on catalog records that fail conversion instead of silently skipping them"],"tags":["rust","protobuf","catalog","conversion"],"backgroundTag":"value-out-of-range","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"}