{"record":{"id":"b1e4499eaad7d03f","repo":"apache/druid","slug":"format-s-not-supported","errorCode":null,"errorMessage":"Format %s not supported","messagePattern":"Format (.+?) not supported","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"processing/src/main/java/org/apache/druid/java/util/common/granularity/Granularity.java","lineNumber":204,"sourceCode":"  public final Interval bucket(DateTime t)\n  {\n    DateTime start = bucketStart(t);\n    return new Interval(start, increment(start));\n  }\n\n  // Used by the toDate implementations.\n  final Integer[] getDateValues(String filePath, Formatter formatter)\n  {\n    Pattern pattern = DEFAULT_PATH_PATTERN;\n    switch (formatter) {\n      case DEFAULT:\n      case LOWER_DEFAULT:\n        break;\n      case HIVE:\n        pattern = HIVE_PATH_PATTERN;\n        break;\n      default:\n        throw new IAE(\"Format %s not supported\", formatter);\n    }\n\n    Matcher matcher = pattern.matcher(filePath);\n\n    // The size is \"7\" b/c this array contains standard\n    // datetime field values namely:\n    // year, monthOfYear, dayOfMonth, hourOfDay, minuteOfHour, secondOfMinute,\n    // and index 0 is unused.\n    Integer[] vals = new Integer[7];\n    if (matcher.matches()) {\n      for (int i = 1; i <= matcher.groupCount(); i++) {\n        vals[i] = (matcher.group(i) != null) ? Integer.parseInt(matcher.group(i)) : null;\n      }\n    }\n\n    return vals;\n  }\n","sourceCodeStart":186,"sourceCodeEnd":222,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/processing/src/main/java/org/apache/druid/java/util/common/granularity/Granularity.java#L186-L222","documentation":"Granularity.getDateValues(filePath, formatter) parses datetime components out of a file path, but only supports the DEFAULT and HIVE path formats. Any other Formatter falls through to `throw new IAE(\"Format %s not supported\", formatter)`. This is input validation over the supported path-pattern enum.","triggerScenarios":"Calling Granularity.getDateValues (or the public path-parsing entry point that reaches it) with a Formatter other than LOWER_DEFAULT or HIVE — e.g. a null or unrecognized formatter value.","commonSituations":"Typo or wrong enum in ingestion path spec; passing a formatter intended for a different API; deserialized configuration containing a formatter name not in the supported set; library versions where additional formats were added/removed.","solutions":["Pass Formatter.DEFAULT or Formatter.HIVE (LOWER_DEFAULT) when parsing dates from file paths","Check the configured formatter value in your spec/JSON for typos or unsupported names","Inspect the Formatter enum available in your Druid version and use one of its path-capable values","If you need another path layout, pre-transform the path to DEFAULT/HIVE layout before calling, or implement custom parsing"],"exampleFix":"// before\ngranularity.toDate(path, Formatter.SOME_UNSUPPORTED_FORMAT);\n// after\ngranularity.toDate(path, Formatter.DEFAULT); // or Formatter.HIVE for hive-style paths","handlingStrategy":"validation","validationCode":"// Only DEFAULT (LOWER_DEFAULT) and HIVE are valid path formats\njava.util.Set<Formatter> supported = java.util.EnumSet.of(Formatter.LOWER_DEFAULT, Formatter.HIVE);\nif (formatter == null || !supported.contains(formatter)) {\n  throw new IllegalArgumentException(\"Formatter must be LOWER_DEFAULT or HIVE, got: \" + formatter);\n}","typeGuard":null,"tryCatchPattern":"try {\n  granularity.toDate(path, formatter);\n} catch (IllegalArgumentException e) {\n  // 'Format %s not supported' — retry with Formatter.DEFAULT after logging the bad config\n}","preventionTips":["Always pass Formatter.DEFAULT or Formatter.HIVE for path-based date parsing","Validate formatter enum values coming from JSON/config before use","Match the formatter to your directory layout (hive-style vs default)","Re-check the Formatter enum after Druid version upgrades for additions/removals"],"tags":["granularity","invalid-argument","path-parsing"],"backgroundTag":"invalid-enum-value","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}