{"record":{"id":"642b175ac3c2f8d6","repo":"influxdata/influxdb","slug":"partition-template-contains-parts-parts-which-exceeds-the","errorCode":null,"errorMessage":"partition template contains {parts} parts, which exceeds the maximum of {MAXIMUM_NUMBER_OF_TEMPLATE_PARTS} parts","messagePattern":"partition template contains (.+?) parts, which exceeds the maximum of (.+?) parts","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"core/partition/src/lib.rs","lineNumber":62,"sourceCode":"    TagValueNotTag(String),\n\n    /// A \"catch all\" error for when a formatter returns [`std::fmt::Error`],\n    /// which contains no context.\n    #[error(\"partition key generation error\")]\n    FmtError(#[from] std::fmt::Error),\n}\n\n/// Returns an iterator identifying consecutive ranges for a given partition key\npub fn partition_batch<'a, T>(\n    batch: &'a T,\n    template: &'a TablePartitionTemplateOverride,\n) -> impl Iterator<Item = (Result<String, PartitionKeyError>, Range<usize>)> + 'a\nwhere\n    T: Batch,\n{\n    let parts = template.len();\n    if parts > MAXIMUM_NUMBER_OF_TEMPLATE_PARTS {\n        panic!(\n            \"partition template contains {parts} parts, which exceeds the maximum of {MAXIMUM_NUMBER_OF_TEMPLATE_PARTS} parts\"\n        );\n    }\n\n    range_encode(partition_keys(batch, template.parts()))\n}\n\n/// Returns an iterator of partition keys for the given table batch.\n///\n/// This function performs deduplication on returned keys; the returned iterator\n/// yields [`Some`] containing the partition key string when a new key is\n/// generated, and [`None`] when the generated key would equal the last key.\npub fn partition_keys<'a, T>(\n    batch: &'a T,\n    template_parts: impl Iterator<Item = TemplatePart<'a>>,\n) -> impl Iterator<Item = Option<Result<String, PartitionKeyError>>> + 'a\nwhere\n    T: Batch,","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/core/partition/src/lib.rs#L44-L80","documentation":"partition_batch panics (via panic!) when the partition template has more parts than MAXIMUM_NUMBER_OF_TEMPLATE_PARTS. This is a programmer/config error guarded as an assertion rather than a Result, because exceeding the limit makes range encoding of keys invalid by design.","triggerScenarios":"Calling partition_batch (or the public partition()/filter_to_partition wrappers) with a Template whose len() exceeds MAXIMUM_NUMBER_OF_TEMPLATE_PARTS, e.g. a user-supplied template string with too many '|'-separated parts.","commonSituations":"Server config with an overly complex partition template (e.g. many tag keys combined); misconfigured region file or query with an excessive template.","solutions":["Reduce the number of parts in the partition template to at most MAXIMUM_NUMBER_OF_TEMPLATE_PARTS","Validate template part count before constructing/calling partition_batch","Check the value of MAXIMUM_NUMBER_OF_TEMPLATE_PARTS in core/partition/src/lib.rs to know the allowed ceiling"],"exampleFix":"// before\nassert!(template.len() <= MAXIMUM_NUMBER_OF_TEMPLATE_PARTS);\nlet iter = partition_batch(&batch, &template);\n// after\nif template.len() > MAXIMUM_NUMBER_OF_TEMPLATE_PARTS {\n    return Err(anyhow!(\"template has {} parts, max is {}\", template.len(), MAXIMUM_NUMBER_OF_TEMPLATE_PARTS));\n}\nlet iter = partition_batch(&batch, &template);","handlingStrategy":"validation","validationCode":"if template.len() > MAXIMUM_NUMBER_OF_TEMPLATE_PARTS {\n    return Err(anyhow!(\"partition template has {} parts; max is {}\", template.len(), MAXIMUM_NUMBER_OF_TEMPLATE_PARTS));\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Count template parts (split on the separator) when loading user config and reject early","Cap template complexity at ingest-config validation time, not partition time","Document MAXIMUM_NUMBER_OF_TEMPLATE_PARTS in operator docs"],"tags":["rust","panic","partitioning","limit-exceeded"],"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"}