{"record":{"id":"d6c689e5137a6d56","repo":"apache/seatunnel","slug":"illegal-format-s-d6c689","errorCode":null,"errorMessage":"Illegal format [%s]","messagePattern":"Illegal format \\[(.+?)\\]","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"seatunnel-common/src/main/java/org/apache/seatunnel/common/utils/TimeUtils.java","lineNumber":93,"sourceCode":"        private final String value;\n\n        Formatter(String value) {\n            this.value = value;\n        }\n\n        public String getValue() {\n            return value;\n        }\n\n        public static Formatter parse(String format) {\n            Formatter[] formatters = Formatter.values();\n            for (Formatter formatter : formatters) {\n                if (formatter.getValue().equals(format)) {\n                    return formatter;\n                }\n            }\n            String errorMsg = String.format(\"Illegal format [%s]\", format);\n            throw new IllegalArgumentException(errorMsg);\n        }\n    }\n}\n","sourceCodeStart":75,"sourceCodeEnd":97,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-common/src/main/java/org/apache/seatunnel/common/utils/TimeUtils.java#L75-L97","documentation":"TimeUtils.parse resolves a string format specifier (e.g. for time units or date patterns) against a list of known Formatter values; if none matches it throws IllegalArgumentException 'Illegal format [<format>]'. This guards against unsupported/misspelled format strings supplied by user configuration.","triggerScenarios":"Calling TimeUtils.parse(format) (or a config option that flows into it) with a string that equals none of the registered Formatter values — typos, wrong case, or a format string the Formatter enum does not support.","commonSituations":"Config typo like 'DAYS' vs 'days' or 'seconds' vs 'second'; user providing a java.time pattern where an enum-style unit name is expected; copied config from an example using an unsupported value.","solutions":["Check the Formatter enum's supported values and use one exactly (match case)","Fix the format value in the job/config file to a supported value","Normalize/validate the config value (trim, lowercase) before passing to TimeUtils.parse","Extend the Formatter enum if a new legitimately supported format is needed (code change)"],"exampleFix":"// before\nTimeUtils.parse(\"Seconds\");\n// after\nTimeUtils.parse(\"seconds\"); // use an exact value from Formatter enum","handlingStrategy":"validation","validationCode":"Set<String> allowed = java.util.Arrays.stream(TimeUtils.Formatter.values())\n    .map(TimeUtils.Formatter::getValue).collect(java.util.stream.Collectors.toSet());\nif (!allowed.contains(format)) {\n  throw new IllegalArgumentException(\"format must be one of \" + allowed + \", got: \" + format);\n}","typeGuard":null,"tryCatchPattern":"try {\n  return TimeUtils.parse(format);\n} catch (IllegalArgumentException e) {\n  log.warn(\"Unsupported format '{}', falling back to default\", format);\n  return TimeUtils.parse(\"seconds\");\n}","preventionTips":["List supported format values in config docs next to the option","Normalize user input (trim/lowercase) before parsing","Validate config at job-submission time, not deep in execution","Reference the Formatter enum as the single source of truth"],"tags":["time","format","invalid-argument"],"backgroundTag":"invalid-enum-value","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}