influxdata/influxdb · error · ValidationError
partition template must include a time format part
Error message
partition template must include a time format part
What it means
Thrown by `TimeFormatPartRequired` when a partition template is built without any TimeFormat part. Every custom partition template must include a time-based part so partitions are anchored to time; the library rejects templates composed only of TagValue/Bucket parts.
Solutions
- Add a `Part::TimeFormat` part (e.g. `%Y`) to the template's parts list.
- If you want daily partitions use `Part::TimeFormat("%Y-%m-%d")`; at minimum include `%Y`.
- If the template comes from a stored config, backfill the missing TimeFormat part before re-applying it.
Example fix
// before
parts: vec![Part::TagValue("region".into())]
// after
parts: vec![Part::TimeFormat("%Y".into()), Part::TagValue("region".into())] Defensive patterns
Strategy: validation
Validate before calling
fn has_time_format(parts: &[Part]) -> bool {
matches!(parts.iter().find(|p| matches!(p, Part::TimeFormat(_))), Some(_))
}
assert!(has_time_format(&parts), "template needs a TimeFormat part"); Try / catch
match PartitionTemplate::new(parts) {
Err(e) if e.to_string().contains("time format part") => {
// auto-heal: prepend a default year part
let mut fixed = vec![Part::TimeFormat("%Y".into())];
fixed.extend(parts);
PartitionTemplate::new(fixed).map_err(Into::into)
}
other => other.map_err(Into::into),
} Prevention
- Always include at least %Y in any custom template.
- Start templates from the default (time-first) template and append tag parts.
- Validate stored/legacy templates for a TimeFormat part before re-applying them.
When it happens
Trigger: Calling `PartitionTemplate::new` (or the create-database template API) with parts like `[Part::TagValue("region")]` and no `Part::TimeFormat`; a migration or tooling path that drops the default `%Y` time format part.
Common situations: Writing a minimal custom template to partition purely by tag and forgetting the time part; older templates written before the time-format requirement was enforced; generated configs omitting the default part.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- Error converting partition_template
- number of buckets in partition template must be in range
- tag name value cannot be repeated 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/cbc25364f6afccac.
Report an issue: GitHub.
Appendix: source
Thrown at core/data_types/src/partition_template.rs:255
"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.
///
/// For example: using %m without %Y.
///
/// [`TimeFormat`]: [`proto::template_part::Part::TimeFormat`]
#[error("missing required specifier(s) in time format of partition template: {0}")]
MissingRequiredStrfTimeSpecifier(String),
}View on GitHub (pinned to 06200ef96b)