{"record":{"id":"d9110a495fe2a0f2","repo":"chinabugotech/hutool","slug":"format-not-supported","errorCode":null,"errorMessage":"Format '{}' not supported","messagePattern":"Format '(.+?)' not supported","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hutool-core/src/main/java/cn/hutool/core/date/format/FastDateParser.java","lineNumber":380,"sourceCode":"\t\t\tsetCalendar(parser, calendar, matcher.group(1));\n\t\t\treturn true;\n\t\t}\n\n\t\tabstract void setCalendar(FastDateParser parser, Calendar cal, String value);\n\t}\n\n\t/**\n\t * Obtain a Strategy given a field from a SimpleDateFormat pattern\n\t *\n\t * @param f                格式\n\t * @param width            长度\n\t * @param definingCalendar The calendar to obtain the short and long values\n\t * @return The Strategy that will handle parsing for the field\n\t */\n\tprivate Strategy getStrategy(final char f, final int width, final Calendar definingCalendar) {\n\t\tswitch (f) {\n\t\t\tdefault:\n\t\t\t\tthrow new IllegalArgumentException(\"Format '\" + f + \"' not supported\");\n\t\t\tcase 'D':\n\t\t\t\treturn DAY_OF_YEAR_STRATEGY;\n\t\t\tcase 'E':\n\t\t\t\treturn getLocaleSpecificStrategy(Calendar.DAY_OF_WEEK, definingCalendar);\n\t\t\tcase 'F':\n\t\t\t\treturn DAY_OF_WEEK_IN_MONTH_STRATEGY;\n\t\t\tcase 'G':\n\t\t\t\treturn getLocaleSpecificStrategy(Calendar.ERA, definingCalendar);\n\t\t\tcase 'H': // Hour in day (0-23)\n\t\t\t\treturn HOUR_OF_DAY_STRATEGY;\n\t\t\tcase 'K': // Hour in am/pm (0-11)\n\t\t\t\treturn HOUR_STRATEGY;\n\t\t\tcase 'M':\n\t\t\t\treturn width >= 3 ? getLocaleSpecificStrategy(Calendar.MONTH, definingCalendar) : NUMBER_MONTH_STRATEGY;\n\t\t\tcase 'S':\n\t\t\t\treturn MILLISECOND_STRATEGY;\n\t\t\tcase 'W':\n\t\t\t\treturn WEEK_OF_MONTH_STRATEGY;","sourceCodeStart":362,"sourceCodeEnd":398,"githubUrl":"https://github.com/chinabugotech/hutool/blob/8870454b2a0c29cc6ffd31dcf5667c8ceb2fc442/hutool-core/src/main/java/cn/hutool/core/date/format/FastDateParser.java#L362-L398","documentation":"Thrown while compiling a FastDateParser pattern: the pattern contained a format letter (A-Z, a-z) that is not handled by getStrategy(). Only the letters supported by the switch (D,E,F,G,H,K,...) are accepted; any other alphabetic pattern character falls through to the default branch.","triggerScenarios":"Using a pattern letter that SimpleDateFormat supports but FastDateParser does not (e.g. some rarely-used letters), or a typo in the pattern such as 'y' vs 'Y' (week-year) or stray letters. The error reports the offending single letter.","commonSituations":"Copying a pattern from Java docs that uses a letter Hutool's FastDateParser does not implement; locale-specific letters; mistyping pattern tokens.","solutions":["Replace the unsupported letter with a supported equivalent or remove it.","Check the FastDateParser.getStrategy switch for the full list of supported letters before relying on a new pattern token.","If the letter is required, fall back to java.text.SimpleDateFormat for that pattern."],"exampleFix":"// before (Y = week-year, may be unsupported in this build)\nFastDateFormat fdf = FastDateFormat.getInstance(\"YYYY-MM-dd\");\n// after\nFastDateFormat fdf = FastDateFormat.getInstance(\"yyyy-MM-dd\");","handlingStrategy":"validation","validationCode":"private static final Set<Character> SUPPORTED = Set.of('y','M','d','H','k','K','h','m','s','S','E','u','D','F','w','W','a','G','z','Z','X');\nvoid checkLetters(String p){ for(char c: p.toCharArray()) if(Character.isLetter(c) && !SUPPORTED.contains(c) ) throw new IllegalArgumentException(\"unsupported pattern letter \"+c); }","typeGuard":null,"tryCatchPattern":"try { FastDateFormat.getInstance(pattern); }\ncatch (IllegalArgumentException e){ if(e.getMessage().startsWith(\"Format '\")) { /* swap letter */ } else throw e; }","preventionTips":["Cross-check pattern letters against FastDateParser.getStrategy before use.","Keep a single source of truth for date patterns in constants.","Add tests for each pattern token you depend on."],"tags":["date","format-pattern","parsing","fast-date","argument"],"backgroundTag":null,"analyzedSha":"8870454b2a0c29cc6ffd31dcf5667c8ceb2fc442","analyzedAt":"2026-08-14T04:01:12.892Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}