apache/seatunnel · error · IllegalArgumentException

Illegal format [ ]

Error message

Illegal format [%s]

What it means

DateUtils.parse resolves a Formatter enum by exact match against the user-supplied date format string. If the format is not one of the supported enumerated formatters, it throws IllegalArgumentException 'Illegal format [x]'.

Solutions

  1. Configure one of the supported date formats from the DateUtils.Formatter enum
  2. Verify exact spelling and separators of the format string
  3. Extend the Formatter enum with the needed pattern if the format is legitimately required

Example fix

// before
date_format = "yyyy/MM/dd" // unsupported
// after
date_format = "yyyy-MM-dd"
Defensive patterns

Strategy: validation

Validate before calling

boolean ok = Arrays.stream(DateUtils.Formatter.values()).anyMatch(f -> f.getValue().equals(userFormat));

Try / catch

try { return DateUtils.parse(value, format); } catch (IllegalArgumentException e) { throw new IllegalArgumentException("Unsupported date_format: " + format, e); }

Prevention

When it happens

Trigger: Calling DateUtils.parse(value, format) with a format string that does not match any supported Formatter value (e.g. 'yyyy/MM/dd' when only 'yyyy-MM-dd'-style values are enumerated).

Common situations: A connector config sets date_format to an unsupported pattern; using a Java pattern that resembles but does not exactly equal an enum value; typos or slash vs dash separators.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/e16709185ababa46. Report an issue: GitHub.

Appendix: source

Thrown at seatunnel-common/src/main/java/org/apache/seatunnel/common/utils/DateUtils.java:220

        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)