{"record":{"id":"9428d4ee5a873522","repo":"influxdata/influxdb","slug":"error-converting-partition-template-0","errorCode":null,"errorMessage":"Error converting partition_template: {0}","messagePattern":"Error converting partition_template: (.+?)","errorType":"exception","errorClass":"ProtoV1AnyWithStorageError","httpStatus":null,"severity":"error","filePath":"core/data_types/src/lib.rs","lineNumber":480,"sourceCode":"            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.\n    fn try_from(value: catalog_storage_proto::NamespaceWithStorage) -> Result<Self, Self::Error> {\n        let max_tables =\n            MaxTables::try_from(value.max_tables).map_err(ProtoV1AnyWithStorageError::MaxTables)?;\n        let max_columns_per_table = MaxColumnsPerTable::try_from(value.max_columns_per_table)\n            .map_err(ProtoV1AnyWithStorageError::MaxColumnsPerTable)?;\n        let partition_template = value\n            .partition_template\n            .map(TryInto::try_into)","sourceCodeStart":462,"sourceCodeEnd":498,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/core/data_types/src/lib.rs#L462-L498","documentation":"ProtoV1AnyWithStorageError::PartitionTemplate is raised when the partition_template field of a proto v1 NamespaceWithStorage/TableWithStorage fails ValidationError during conversion into the native PartitionTemplate type — the stored partitioning spec is structurally or semantically invalid.","triggerScenarios":"Converting a v1 proto whose partition_template violates validation rules (bad partition types, invalid column references, malformed template parts).","commonSituations":"Partition templates written by other tooling or versions with unsupported parts; users configuring invalid partitioning that was persisted and now fails on read; schema changes removing columns referenced by a stored template.","solutions":["Fix the partition_template in the stored proto so it passes ValidationError rules (valid parts, existing columns)","Recreate the namespace/table with a valid partition template","Check for version mismatches between the writer and reader of the proto"],"exampleFix":"// before (proto template)\nparts: [{type: PARTITION_BY_UNKNOWN_COLUMN, column: \"gone\"}]\n// after\nparts: [{type: PARTITION_BY_STRING, column: \"region\"}] // valid existing column","handlingStrategy":"validation","validationCode":"fn partition_template_valid(t: &PartitionTemplateProto) -> bool {\n    !t.parts.is_empty() && t.parts.iter().all(|p| p.column_is_known() && p.r#type_is_supported())\n}","typeGuard":null,"tryCatchPattern":"let ns = NamespaceWithStorage::try_from(proto).map_err(|e| match e {\n    ProtoV1AnyWithStorageError::PartitionTemplate(src) => anyhow!(\"invalid partition template: {}\", src),\n    other => anyhow!(other),\n})?;","preventionTips":["Validate partition templates with the library's validator before persisting","Ensure columns referenced by templates still exist when schemas change","Avoid writing partition templates with unsupported part types"],"tags":["rust","protobuf","partitioning","validation"],"backgroundTag":"schema-validation-failed","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"}