influxdata/influxdb · error · ValidationError

tag name value cannot be repeated in partition template

Error message

tag name value cannot be repeated in partition template: {0}

What it means

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.

Solutions

  1. Deduplicate the template parts so each tag name appears in at most one TagValue or Bucket part.
  2. If both raw value and bucketing are desired, keep only the Bucket part for that tag (bucketing already partitions on it).
  3. Before constructing the template, scan the part list for duplicate tag names and reject with a clear client-side error.

Example fix

// before
parts: vec![Part::TagValue("region".into()), Part::Bucket("region".into(), 4)]
// after
parts: vec![Part::Bucket("region".into(), 4)]
Defensive patterns

Strategy: validation

Validate before calling

fn no_duplicate_tags(parts: &[Part]) -> bool {
    let mut names: Vec<&str> = parts.iter().filter_map(|p| p.tag_name()).collect();
    names.sort(); names.dedup();
    names.len() == parts.iter().filter(|p| p.tag_name().is_some()).count()
}

Try / catch

match PartitionTemplate::new(parts) {
    Err(e) if e.to_string().contains("cannot be repeated") => {
        eprintln!("duplicate tag name in template parts: {e}");
        Err(e.into())
    }
    other => other.map_err(Into::into),
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19). Data as JSON: /api/errors/d312aa3587ae947b. Report an issue: GitHub.

Appendix: source

Thrown at core/data_types/src/partition_template.rs:248

    InvalidTagValue(String),

    /// The partition template defines a [`Bucket`] part, but the provided
    /// number of buckets is invalid.
    ///
    /// [`Bucket`]: [`proto::template_part::Part::Bucket`]
    #[error(
        "number of buckets in partition template must be in range \
        [{ALLOWED_BUCKET_QUANTITIES:?}), number specified: {0}"
    )]
    InvalidNumberOfBuckets(u32),

    /// The partition template defines a [`TagValue`] or [`Bucket`] part
    /// which repeats a tag name used in another [`TagValue`] or [`Bucket`] part.
    /// This is not allowed
    ///
    /// [`TagValue`]: [`proto::template_part::Part::TagValue`]
    /// [`Bucket`]: [`proto::template_part::Part::Bucket`]
    #[error("tag name value cannot be repeated in partition template: {0}")]
    RepeatedTagValue(String),

    /// An attempt to make a new partition template without a [`TimeFormat`]
    /// part has been made. This is not allowed.
    ///
    /// [`TimeFormat`]: [`proto::template_part::Part::TimeFormat`]
    #[error("partition template must include a time format part")]
    TimeFormatPartRequired,

    /// The partition template defines a [`TimeFormat`] part, but the
    /// provided strftime formatter contains unsupported specifiers.
    ///
    /// [`TimeFormat`]: [`proto::template_part::Part::TimeFormat`]
    #[error("unsupported specifier found in time format \"{0}\" - supported specifiers: {1}")]
    UnsupportedStrfTimeSpecifier(String, String),

    /// The partition template defines a [`TimeFormat`] part, but the
    /// provided strftime format that is missing required specifiers.

View on GitHub (pinned to 06200ef96b)