influxdata/influxdb · error · ValidationError
invalid tag name value in partition template
Error message
invalid tag name value in partition template: {0} What it means
This error is returned when a partition template defines a `TagValue` or `Bucket` part whose tag name is invalid. Tag names must satisfy identifier rules (e.g., non-empty, valid characters, collision-free within the template), and the library rejects the template at validation time. The invalid tag name is carried in the `String` payload.
Solutions
- Correct the tag name in the error payload to a valid identifier (non-empty, allowed characters only, e.g. letters/digits/underscores)
- Ensure the name matches an existing column/tag in the schema you intend to partition on
- Sanitize or validate user-supplied tag names before constructing the template
- If migrating templates from another system, rename parts that use characters this library disallows
Example fix
// before
builder.add_tag_part(""); // invalid: empty tag name
// after
builder.add_tag_part("region"); Defensive patterns
Strategy: validation
Validate before calling
fn is_valid_tag_name(name: &str) -> bool {
!name.is_empty()
&& name.chars().all(|c| c.is_ascii_alphanumeric() || c == '_')
}
if !is_valid_tag_name(&tag) { return Err(format!("invalid tag name: {:?}", tag)); } Type guard
fn valid_tag_part(name: &str) -> Option<&str> {
is_valid_tag_name(name).then_some(name)
} Try / catch
let template = builder.build().map_err(|e| match e {
ValidationError::InvalidTagValue(name) => anyhow!("tag name {:?} is invalid: use non-empty identifier-safe characters", name),
other => anyhow!(other),
})?; Prevention
- Sanitize user/config-provided tag names (trim, strip illegal characters) before adding parts
- Match tag names against the table schema so they reference real columns
- Reject empty or whitespace-only names at the API boundary
- When importing templates from other systems, normalize names to the library's identifier rules
When it happens
Trigger: Calling `PartitionTemplateBuilder::add_tag_part(name)` or `add_bucket_part(name, ...)` (or validating a proto template whose part is `TagValue`/`Bucket`) with a name failing tag-name validation — empty string, illegal characters, whitespace, or control characters.
Common situations: Config-driven template generation passing empty or placeholder names; column names containing spaces/special characters from other systems; user DDL input with typos or quoting mistakes; names truncated or mangled by upstream parsing.
Understand the failure class
Background: "invalid id" errors: invalid identifier format — why libraries reject IDs before lookup, and how to fix them — this error's family across 37 libraries.
Related errors
- Custom partition template must have at least one part
- Custom partition template specified
- invalid strftime format in partition template
- All `DataPoints` must have at least one field. Builder…
- call site contains null bytes
AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19).
Data as JSON: /api/errors/f948b08a96a462ce.
Report an issue: GitHub.
Appendix: source
Thrown at core/data_types/src/partition_template.rs:229
TooManyParts {
/// The number of template parts that were present in the user-provided custom partition
/// template.
specified: usize,
},
/// The partition template defines a [`TimeFormat`] part, but the
/// provided strftime formatter is invalid.
///
/// [`TimeFormat`]: [`proto::template_part::Part::TimeFormat`]
#[error("invalid strftime format in partition template: {0}")]
InvalidStrftime(String),
/// The partition template defines a [`TagValue`] part or [`Bucket`] part,
/// but the provided tag name value is invalid.
///
/// [`TagValue`]: [`proto::template_part::Part::TagValue`]
/// [`Bucket`]: [`proto::template_part::Part::Bucket`]
#[error("invalid tag name value in partition template: {0}")]
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`]View on GitHub (pinned to 06200ef96b)