apache/seatunnel · error · IllegalArgumentException
Illegal format [ ]
Error message
Illegal format [%s]
What it means
DateTimeUtils.parse resolves a Formatter enum by exact match against the user-supplied date-time format string. If the format does not correspond to any supported formatter, it throws IllegalArgumentException 'Illegal format [x]'.
Solutions
- Use one of the supported formats listed by DateTimeUtils.Formatter enum values
- Check exact spelling/casing of the configured format string
- If a new pattern is required, add a Formatter enum entry for it and submit/patch the code
Example fix
// before datetime_format = "dd/MM/yyyy HH:mm" // unsupported // after datetime_format = "yyyy-MM-dd HH:mm:ss"
Defensive patterns
Strategy: validation
Validate before calling
boolean ok = Arrays.stream(DateTimeUtils.Formatter.values()).anyMatch(f -> f.getValue().equals(userFormat));
Try / catch
try { return DateTimeUtils.parse(value, format); } catch (IllegalArgumentException e) { throw new IllegalArgumentException("Unsupported datetime_format: " + format, e); } Prevention
- Copy supported format strings from the Formatter enum, not arbitrary patterns
- Validate datetime_format in connector option parsing
- Write a config-validation test covering each supported format
When it happens
Trigger: Calling DateTimeUtils.parse(value, format) with a format string that is not one of the enumerated supported values (e.g. an unsupported pattern instead of 'yyyy-MM-dd HH:mm:ss').
Common situations: Sink/source config uses a datetime_format pattern the parser does not recognize; copied a Java SimpleDateFormat pattern that is not in the Formatter enum; typo or different casing in the configured format.
Related errors
- Illegal format [ ]
- Already an MDCStream
- Already an MDCSupplier
- bucketCount must be greater than zero, but was
- COMMON-33
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/892fc4b00c7a80ce.
Report an issue: GitHub.
Appendix: source
Thrown at seatunnel-common/src/main/java/org/apache/seatunnel/common/utils/DateTimeUtils.java:371
private final String value;
Formatter(String value) {
this.value = value;
}
public String getValue() {
return value;
}
public static Formatter parse(String format) {
Formatter[] formatters = Formatter.values();
for (Formatter formatter : formatters) {
if (formatter.getValue().equals(format)) {
return formatter;
}
}
String errorMsg = String.format("Illegal format [%s]", format);
throw new IllegalArgumentException(errorMsg);
}
}
}
View on GitHub (pinned to cf67b549a7)