{"record":{"id":"d312aa3587ae947b","repo":"influxdata/influxdb","slug":"tag-name-value-cannot-be-repeated-in-partition-template-0","errorCode":null,"errorMessage":"tag name value cannot be repeated in partition template: {0}","messagePattern":"tag name value cannot be repeated in partition template: (.+?)","errorType":"validation","errorClass":"ValidationError","httpStatus":null,"severity":"error","filePath":"core/data_types/src/partition_template.rs","lineNumber":248,"sourceCode":"    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`]\n    #[error(\"partition template must include a time format part\")]\n    TimeFormatPartRequired,\n\n    /// The partition template defines a [`TimeFormat`] part, but the\n    /// provided strftime formatter contains unsupported specifiers.\n    ///\n    /// [`TimeFormat`]: [`proto::template_part::Part::TimeFormat`]\n    #[error(\"unsupported specifier found in time format \\\"{0}\\\" - supported specifiers: {1}\")]\n    UnsupportedStrfTimeSpecifier(String, String),\n\n    /// The partition template defines a [`TimeFormat`] part, but the\n    /// provided strftime format that is missing required specifiers.","sourceCodeStart":230,"sourceCodeEnd":266,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/core/data_types/src/partition_template.rs#L230-L266","documentation":"Thrown by `RepeatedTagValue` when a partition template defines two parts (TagValue or Bucket) that reference the same tag name. Each tag may appear at most once in a template, because repeating it would produce redundant partition key columns and duplicated data in the catalog.","triggerScenarios":"Constructing a `PartitionTemplate` whose parts include e.g. `[TagValue(\"region\"), Bucket(\"region\")]` or two TagValue parts with the same tag name; submitting such a template via the InfluxDB 3 `create database ... WITH template` API.","commonSituations":"Copy-pasting template parts and forgetting to change the tag name; adding a bucket part for a tag that already has a TagValue part; config generation scripts that merge parts from multiple sources.","solutions":["Deduplicate the template parts so each tag name appears in at most one TagValue or Bucket part.","If both raw value and bucketing are desired, keep only the Bucket part for that tag (bucketing already partitions on it).","Before constructing the template, scan the part list for duplicate tag names and reject with a clear client-side error."],"exampleFix":"// before\nparts: vec![Part::TagValue(\"region\".into()), Part::Bucket(\"region\".into(), 4)]\n// after\nparts: vec![Part::Bucket(\"region\".into(), 4)]","handlingStrategy":"validation","validationCode":"fn no_duplicate_tags(parts: &[Part]) -> bool {\n    let mut names: Vec<&str> = parts.iter().filter_map(|p| p.tag_name()).collect();\n    names.sort(); names.dedup();\n    names.len() == parts.iter().filter(|p| p.tag_name().is_some()).count()\n}","typeGuard":null,"tryCatchPattern":"match PartitionTemplate::new(parts) {\n    Err(e) if e.to_string().contains(\"cannot be repeated\") => {\n        eprintln!(\"duplicate tag name in template parts: {e}\");\n        Err(e.into())\n    }\n    other => other.map_err(Into::into),\n}","preventionTips":["Deduplicate parts by tag name before building the template.","Never add both a TagValue and a Bucket part for the same tag.","Keep template definitions in one reviewed source, not merged ad hoc from multiple configs."],"tags":["rust","partitioning","duplicate-key","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"}