languagetool-org/languagetool · error · RuntimeException
Could not find day of week for '" + dayStr + "'
Error message
Could not find day of week for '" + dayStr + "'
What it means
The Esperanto DateCheckFilter maps Esperanto weekday-name prefixes to Calendar constants. getDayOfWeek throws a RuntimeException when the given day string does not start with any known Esperanto (or transliterated) weekday prefix such as 'ven' or 'sab'.
Source
Thrown at languagetool-language-modules/eo/src/main/java/org/languagetool/rules/eo/DateCheckFilter.java:88
if (day.equals("naua")) n += 9;
return n;
}
@SuppressWarnings("ControlFlowStatementWithoutBraces")
@Override
protected int getDayOfWeek(String dayStr) {
String day = dayStr.toLowerCase();
if (day.startsWith("dim")) return Calendar.SUNDAY;
if (day.startsWith("lun")) return Calendar.MONDAY;
if (day.startsWith("mar")) return Calendar.TUESDAY;
if (day.startsWith("mer")) return Calendar.WEDNESDAY;
if (day.startsWith("ĵaŭ")) return Calendar.THURSDAY;
if (day.startsWith("jau")) return Calendar.THURSDAY;
if (day.startsWith("jhau")) return Calendar.THURSDAY;
if (day.startsWith("jxau")) return Calendar.THURSDAY;
if (day.startsWith("ven")) return Calendar.FRIDAY;
if (day.startsWith("sab")) return Calendar.SATURDAY;
throw new RuntimeException("Could not find day of week for '" + dayStr + "'");
}
@SuppressWarnings("ControlFlowStatementWithoutBraces")
@Override
protected String getDayOfWeek(Calendar date) {
String englishDay=date.getDisplayName(Calendar.DAY_OF_WEEK, Calendar.LONG, Locale.UK);
if (englishDay.equals("Sunday")) return "dimanĉo";
if (englishDay.equals("Monday")) return "lundo";
if (englishDay.equals("Tuesday")) return "mardo";
if (englishDay.equals("Wednesday")) return "merkredo";
if (englishDay.equals("Thursday")) return "jaŭdo";
if (englishDay.equals("Friday")) return "vendredo";
if (englishDay.equals("Saturday")) return "sabato";
return "";
}
@SuppressWarnings({"ControlFlowStatementWithoutBraces", "MagicNumber"})
@OverrideView on GitHub (pinned to 2e990059ce)
Solutions
- Verify the rule pattern only captures actual Esperanto weekday names.
- Check the day string for typos or unsupported transliterations (e.g. 'jhau'/'jxau' variants) and add a prefix case if a legitimate spelling is missing.
- Validate input in the rule so non-weekday tokens never reach the filter.
Example fix
// before
callGetDayOfWeek("lundoj"); // not matched
// after
callGetDayOfWeek("lun"); // matches Calendar.MONDAY Defensive patterns
Strategy: validation
Validate before calling
List<String> prefixes = List.of("lun","mar","mer","ĵaŭ","jau","jhau","jxau","ven","sab");
String day = dayStr.toLowerCase();
if (prefixes.stream().noneMatch(day::startsWith)) throw new IllegalArgumentException("Not an Esperanto weekday: " + dayStr); Try / catch
try {
int dow = filter.getDayOfWeek(dayStr);
} catch (RuntimeException e) {
if (e.getMessage().startsWith("Could not find day of week")) { /* skip or log invalid day token */ }
} Prevention
- Ensure rule patterns only capture genuine Esperanto weekday tokens
- Normalize input to lowercase before lookup
- Add transliteration variants if your corpus uses them
When it happens
Trigger: A date-check rule passes a 'weekDay' token whose normalized lowercase text does not match any Esperanto weekday prefix handled by the if-chain (e.g. a misspelled day or a non-Esperanto word).
Common situations: Rules matching a token that turns out not to be a weekday; typos in rule patterns; alternate spellings not covered by the prefix list; test calls with invalid day strings (as in testGetDayOfWeek).
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- Could not find month '" + monthStr + "'
- Set only 'weekDay' and 'date' for " + YMDDateCheckFilter.cla
- Format error in file ${path}, line: ${line}
- No IssueType found for name '" + name + "'. Valid values: "
- The number of forms and postags has to be the same in disamb
AI-assisted analysis of languagetool-org/languagetool@2e990059ce (2026-09-06).
Data as JSON: /api/errors/e32b0a8b2bce16e6.
Report an issue: GitHub.