apache/druid · error · IllegalArgumentException
Format %s not supported
Error message
Format %s not supported
What it means
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.
Source
Thrown at processing/src/main/java/org/apache/druid/java/util/common/granularity/Granularity.java:204
public final Interval bucket(DateTime t)
{
DateTime start = bucketStart(t);
return new Interval(start, increment(start));
}
// Used by the toDate implementations.
final Integer[] getDateValues(String filePath, Formatter formatter)
{
Pattern pattern = DEFAULT_PATH_PATTERN;
switch (formatter) {
case DEFAULT:
case LOWER_DEFAULT:
break;
case HIVE:
pattern = HIVE_PATH_PATTERN;
break;
default:
throw new IAE("Format %s not supported", formatter);
}
Matcher matcher = pattern.matcher(filePath);
// The size is "7" b/c this array contains standard
// datetime field values namely:
// year, monthOfYear, dayOfMonth, hourOfDay, minuteOfHour, secondOfMinute,
// and index 0 is unused.
Integer[] vals = new Integer[7];
if (matcher.matches()) {
for (int i = 1; i <= matcher.groupCount(); i++) {
vals[i] = (matcher.group(i) != null) ? Integer.parseInt(matcher.group(i)) : null;
}
}
return vals;
}
View on GitHub (pinned to 9b90983fd2)
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
Example fix
// before granularity.toDate(path, Formatter.SOME_UNSUPPORTED_FORMAT); // after granularity.toDate(path, Formatter.DEFAULT); // or Formatter.HIVE for hive-style paths
Defensive patterns
Strategy: validation
Validate before calling
// Only DEFAULT (LOWER_DEFAULT) and HIVE are valid path formats
java.util.Set<Formatter> supported = java.util.EnumSet.of(Formatter.LOWER_DEFAULT, Formatter.HIVE);
if (formatter == null || !supported.contains(formatter)) {
throw new IllegalArgumentException("Formatter must be LOWER_DEFAULT or HIVE, got: " + formatter);
} Try / catch
try {
granularity.toDate(path, formatter);
} catch (IllegalArgumentException e) {
// 'Format %s not supported' — retry with Formatter.DEFAULT after logging the bad config
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- Overlapping intervals: %s, %s
- Granularity is not supported. [%s]
- Only PeriodGranulaity is supported for movingAverage queries
- Cannot accept both 'splitPoints' and 'numBins'
- bf1Length %d does not match bf2Length %d
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/b1e4499eaad7d03f.
Report an issue: GitHub.