{"record":{"id":"afa71224b39e7268","repo":"influxdata/influxdb","slug":"missing-required-specifier-s-in-time-format-of-partition","errorCode":null,"errorMessage":"missing required specifier(s) in time format of partition template: {0}","messagePattern":"missing required specifier\\(s\\) in time format of partition template: (.+?)","errorType":"validation","errorClass":"ValidationError","httpStatus":null,"severity":"error","filePath":"core/data_types/src/partition_template.rs","lineNumber":271,"sourceCode":"    ///\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.\n    ///\n    /// For example: using %m without %Y.\n    ///\n    /// [`TimeFormat`]: [`proto::template_part::Part::TimeFormat`]\n    #[error(\"missing required specifier(s) in time format of partition template: {0}\")]\n    MissingRequiredStrfTimeSpecifier(String),\n}\n\n/// The maximum number of template parts a custom partition template may specify, to limit the\n/// amount of space in the catalog used by the custom partition template and the partition keys\n/// created with it.\npub const MAXIMUM_NUMBER_OF_TEMPLATE_PARTS: usize = 8;\n\n/// The sentinel character used to delimit partition key parts in the partition\n/// key string.\npub const PARTITION_KEY_DELIMITER: char = '|';\n\n/// The sentinel character used to indicate an empty string partition key part\n/// in the partition key string.\npub const PARTITION_KEY_VALUE_EMPTY: char = '^';\n\n/// The `str` form of the [`PARTITION_KEY_VALUE_EMPTY`] character.\npub const PARTITION_KEY_VALUE_EMPTY_STR: &str = \"^\";","sourceCodeStart":253,"sourceCodeEnd":289,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/core/data_types/src/partition_template.rs#L253-L289","documentation":"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.","triggerScenarios":"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.","commonSituations":"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\".","solutions":["Prepend %Y to the format (e.g. change \"%m-%d\" to \"%Y-%m-%d\").","Ensure every finer specifier used has all its coarser prerequisites: %d needs %m and %Y; %m needs %Y.","Validate the format string against the required-specifier rules before submitting the template."],"exampleFix":"// before\nPart::TimeFormat(\"%m-%d\".into())\n// after\nPart::TimeFormat(\"%Y-%m-%d\".into())","handlingStrategy":"validation","validationCode":"fn has_required_specifiers(fmt: &str) -> bool {\n    let has = |s: &str| fmt.contains(s);\n    if !has(\"%Y\") { return false; }\n    if has(\"%d\") && !has(\"%m\") { return false; }\n    if has(\"%M\") && !has(\"%H\") { return false; }\n    true\n}","typeGuard":null,"tryCatchPattern":"match PartitionTemplate::new(parts) {\n    Err(e) if e.to_string().contains(\"missing required specifier\") => {\n        eprintln!(\"time format missing required specifier(s) (typically %Y): {e}\");\n        Err(e.into())\n    }\n    other => other.map_err(Into::into),\n}","preventionTips":["Always include %Y in time formats; prefer full forms like %Y-%m-%d.","Derive formats from a granularity enum that emits complete strings (e.g. monthly -> \"%Y-%m\").","Check coarser-specifier prerequisites whenever adding finer ones."],"tags":["rust","partitioning","strftime","date-format"],"backgroundTag":"invalid-date-format","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"}