{"record":{"id":"637a0d86f33ee673","repo":"influxdata/influxdb","slug":"number-of-buckets-in-partition-template-must-be-in-range","errorCode":null,"errorMessage":"number of buckets in partition template must be in range [{ALLOWED_BUCKET_QUANTITIES:?}), number specified: {0}","messagePattern":"number of buckets in partition template must be in range \\[(.+?)\\), number specified: (.+?)","errorType":"validation","errorClass":"ValidationError","httpStatus":null,"severity":"error","filePath":"core/data_types/src/partition_template.rs","lineNumber":236,"sourceCode":"    /// provided strftime formatter is invalid.\n    ///\n    /// [`TimeFormat`]: [`proto::template_part::Part::TimeFormat`]\n    #[error(\"invalid strftime format in partition template: {0}\")]\n    InvalidStrftime(String),\n\n    /// The partition template defines a [`TagValue`] part or [`Bucket`] part,\n    /// but the provided tag name value is invalid.\n    ///\n    /// [`TagValue`]: [`proto::template_part::Part::TagValue`]\n    /// [`Bucket`]: [`proto::template_part::Part::Bucket`]\n    #[error(\"invalid tag name value in partition template: {0}\")]\n    InvalidTagValue(String),\n\n    /// The partition template defines a [`Bucket`] part, but the provided\n    /// number of buckets is invalid.\n    ///\n    /// [`Bucket`]: [`proto::template_part::Part::Bucket`]\n    #[error(\n        \"number of buckets in partition template must be in range \\\n        [{ALLOWED_BUCKET_QUANTITIES:?}), number specified: {0}\"\n    )]\n    InvalidNumberOfBuckets(u32),\n\n    /// The partition template defines a [`TagValue`] or [`Bucket`] part\n    /// which repeats a tag name used in another [`TagValue`] or [`Bucket`] part.\n    /// This is not allowed\n    ///\n    /// [`TagValue`]: [`proto::template_part::Part::TagValue`]\n    /// [`Bucket`]: [`proto::template_part::Part::Bucket`]\n    #[error(\"tag name value cannot be repeated in partition template: {0}\")]\n    RepeatedTagValue(String),\n\n    /// An attempt to make a new partition template without a [`TimeFormat`]\n    /// part has been made. This is not allowed.\n    ///\n    /// [`TimeFormat`]: [`proto::template_part::Part::TimeFormat`]","sourceCodeStart":218,"sourceCodeEnd":254,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/core/data_types/src/partition_template.rs#L218-L254","documentation":"This error is thrown by `InvalidNumberOfBuckets` in the partition template validation of core/data_types. A partition template that includes a Bucket part must specify how many buckets the tag value is hashed into, and that count must be one of the pre-approved `ALLOWED_BUCKET_QUANTITIES` values. The library rejects any other number to bound the number of distinct partitions created in the catalog.","triggerScenarios":"Calling the partition-template constructor/validator (e.g. `PartitionTemplate::new` / proto conversion from `template_part::Part::Bucket`) with a bucket count that is not one of the allowed quantities, e.g. `Part::Bucket(7)` when only 1, 2, 4, 8 are allowed.","commonSituations":"Hand-writing an InfluxDB 3 custom partition template JSON and picking an arbitrary bucket count; generating bucket counts programmatically without checking the allowed list; copying an example with a different bucket count.","solutions":["Change the bucket count in the Bucket template part to a value listed in `ALLOWED_BUCKET_QUANTITIES` (see core/data_types/src/partition_template.rs).","If you need finer cardinality control, stack multiple allowed bucket parts or combine a Bucket part with TagValue parts instead of using a non-standard count.","If the count comes from user config, validate it against the allowed quantities before constructing the template and return a friendly message."],"exampleFix":"// before\nlet part = Part::Bucket(7);\n// after\nlet part = Part::Bucket(8); // 8 is in ALLOWED_BUCKET_QUANTITIES","handlingStrategy":"validation","validationCode":"const ALLOWED_BUCKET_QUANTITIES: &[u32] = &[1, 2, 4, 8, 16, 32, 64, 128]; // see partition_template.rs\nfn valid_bucket_count(n: u32) -> bool { ALLOWED_BUCKET_QUANTITIES.contains(&n) }\nif !valid_bucket_count(n) { return Err(format!(\"bucket count {n} not in {ALLOWED_BUCKET_QUANTITIES:?}\")); }","typeGuard":null,"tryCatchPattern":"// if constructing dynamically:\nmatch PartitionTemplate::new(parts) {\n    Ok(t) => t,\n    Err(e) if e.to_string().contains(\"number of buckets\") => {\n        eprintln!(\"bucket count rejected, allowed: {ALLOWED_BUCKET_QUANTITIES:?}\");\n        return Err(e.into());\n    }\n    Err(e) => return Err(e.into()),\n}","preventionTips":["Define bucket counts only from the published ALLOWED_BUCKET_QUANTITIES list.","Validate user-supplied bucket counts at config-parse time, before calling the library.","Add a unit test covering every bucket count your tooling can emit."],"tags":["rust","partitioning","configuration","validation"],"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"}