{"record":{"id":"e1ed7fadfe4150ce","repo":"languagetool-org/languagetool","slug":"could-not-find-month-monthstr-e1ed7f","errorCode":null,"errorMessage":"Could not find month '<monthStr>'","messagePattern":"Could not find month '<monthStr>'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"languagetool-language-modules/nl/src/main/java/org/languagetool/rules/nl/DateCheckFilter.java","lineNumber":84,"sourceCode":"  @SuppressWarnings({\"ControlFlowStatementWithoutBraces\", \"MagicNumber\"})\n  @Override\n  protected int getMonth(String monthStr) {\n    String mon = monthStr.toLowerCase();\n    if (mon.startsWith(\"jan\")) return 1;\n    if (mon.startsWith(\"feb\")) return 2;\n    if (mon.startsWith(\"maa\")) return 3;\n    if (mon.startsWith(\"mrt\")) return 3;\n    if (mon.startsWith(\"mar\")) return 3;\n    if (mon.startsWith(\"apr\")) return 4;\n    if (mon.startsWith(\"mei\")) return 5;\n    if (mon.startsWith(\"jun\")) return 6;\n    if (mon.startsWith(\"jul\")) return 7;\n    if (mon.startsWith(\"aug\")) return 8;\n    if (mon.startsWith(\"sep\")) return 9;\n    if (mon.startsWith(\"okt\") || mon.startsWith(\"oct\")) return 10;\n    if (mon.startsWith(\"nov\")) return 11;\n    if (mon.startsWith(\"dec\")) return 12;\n    throw new RuntimeException(\"Could not find month '\" + monthStr + \"'\");\n  }\n\n  @Override\n  protected String getErrorMessageWrongYear() {\n    return \"Deze datum is onjuist. Bedoelt u misschien \\\"{currentYear}\\\"?\";\n  }\n}\n","sourceCodeStart":66,"sourceCodeEnd":92,"githubUrl":"https://github.com/languagetool-org/languagetool/blob/2e990059ce67d5e2a0f7f7ca5d31160c6709df4b/languagetool-language-modules/nl/src/main/java/org/languagetool/rules/nl/DateCheckFilter.java#L66-L92","documentation":"The Dutch DateCheckFilter's getMonth maps Dutch month names/abbreviations (jan…dec, including okt/oct) to month numbers and throws this RuntimeException when no prefix matches. It indicates the rule fed an unrecognized month token into the filter.","triggerScenarios":"A rule passes a month string not starting with jan/feb/mrt|maa/apr/mei/jun/jul/aug/sep/okt/oct/nov/dec (e.g. English 'march', a Roman numeral, or unexpected abbreviation).","commonSituations":"Adding new month abbreviations to a rule regex without extending getMonth; mixed-case input failing startsWith checks; language mixing where an English/German month token is matched.","solutions":["Add a mapping for the unrecognized prefix shown in the message","Lowercase/normalize the token before the checks","Keep the rule's regex alternation synchronized with the prefixes handled in getMonth"],"exampleFix":"// before\nif (mon.startsWith(\"dec\")) return 12;\nthrow new RuntimeException(\"Could not find month '\" + monthStr + \"'\");\n// after\nString m = monthStr.toLowerCase();\nif (m.startsWith(\"dec\")) return 12;\nthrow new RuntimeException(\"Could not find month '\" + monthStr + \"'\");","handlingStrategy":"validation","validationCode":"if (monthStr == null || monthStr.isBlank() || !monthStr.toLowerCase().matches(\"(jan|feb|mrt|maa|apr|mei|jun|jul|aug|sep|okt|oct|nov|dec).*\")) throw new IllegalArgumentException(\"Unrecognized Dutch month: \" + monthStr);","typeGuard":"boolean isDutchMonth(String s) { String m = s == null ? \"\" : s.toLowerCase(); return m.startsWith(\"jan\")||m.startsWith(\"feb\")||m.startsWith(\"mrt\")||m.startsWith(\"maa\")||m.startsWith(\"apr\")||m.startsWith(\"mei\")||m.startsWith(\"jun\")||m.startsWith(\"jul\")||m.startsWith(\"aug\")||m.startsWith(\"sep\")||m.startsWith(\"okt\")||m.startsWith(\"oct\")||m.startsWith(\"nov\")||m.startsWith(\"dec\"); }","tryCatchPattern":"try { month = filter.getMonth(monthStr); } catch (RuntimeException e) { log.warn(\"Dutch month not recognized: {}\", monthStr); return null; }","preventionTips":["Lowercase the token before calling getMonth (checks are case-sensitive startsWith)","Test every month abbreviation your rule regex accepts","Don't feed Roman numerals or foreign month names into the filter"],"tags":["java","nlp","grammar-rules","date-validation"],"backgroundTag":"invalid-enum-value","analyzedSha":"2e990059ce67d5e2a0f7f7ca5d31160c6709df4b","analyzedAt":"2026-09-06T09:20:17.015Z","contentChangedAt":"2026-09-06T09:20:17.015Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}