influxdata/influxdb · error · ValidationError

missing required specifier(s) in time format of partition…

Error message

missing required specifier(s) in time format of partition template: {0}

What it means

Thrown by `MissingRequiredStrfTimeSpecifier` when the TimeFormat part is valid but incomplete: it lacks required specifiers, typically %Y. Finer-grained specifiers like %m or %d are meaningless without the coarser ones, since partition keys must be progressively time-ordered.

Solutions

  1. Prepend %Y to the format (e.g. change "%m-%d" to "%Y-%m-%d").
  2. Ensure every finer specifier used has all its coarser prerequisites: %d needs %m and %Y; %m needs %Y.
  3. Validate the format string against the required-specifier rules before submitting the template.

Example fix

// before
Part::TimeFormat("%m-%d".into())
// after
Part::TimeFormat("%Y-%m-%d".into())
Defensive patterns

Strategy: validation

Validate before calling

fn has_required_specifiers(fmt: &str) -> bool {
    let has = |s: &str| fmt.contains(s);
    if !has("%Y") { return false; }
    if has("%d") && !has("%m") { return false; }
    if has("%M") && !has("%H") { return false; }
    true
}

Try / catch

match PartitionTemplate::new(parts) {
    Err(e) if e.to_string().contains("missing required specifier") => {
        eprintln!("time format missing required specifier(s) (typically %Y): {e}");
        Err(e.into())
    }
    other => other.map_err(Into::into),
}

Prevention

When it happens

Trigger: Creating a template with `Part::TimeFormat("%m-%d")` (no %Y) or `Part::TimeFormat("%H")` — the validator requires e.g. %Y whenever %m/%d are used.

Common situations: Assuming month-only partitioning without a year; truncating a longer format string during config editing; tools that build formats from a granularity enum but map 'monthly' to "%m" instead of "%Y-%m".

Related errors


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

Appendix: source

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

    ///
    /// [`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),
}

/// The maximum number of template parts a custom partition template may specify, to limit the
/// amount of space in the catalog used by the custom partition template and the partition keys
/// created with it.
pub const MAXIMUM_NUMBER_OF_TEMPLATE_PARTS: usize = 8;

/// The sentinel character used to delimit partition key parts in the partition
/// key string.
pub const PARTITION_KEY_DELIMITER: char = '|';

/// The sentinel character used to indicate an empty string partition key part
/// in the partition key string.
pub const PARTITION_KEY_VALUE_EMPTY: char = '^';

/// The `str` form of the [`PARTITION_KEY_VALUE_EMPTY`] character.
pub const PARTITION_KEY_VALUE_EMPTY_STR: &str = "^";

View on GitHub (pinned to 06200ef96b)