languagetool-org/languagetool · error · RuntimeException
throw new RuntimeException(e)
Error message
throw new RuntimeException(e)
What it means
Spanish.filterRuleMatches filters out voseo forms from rule-match suggestions. For each suggestion it re-tags the word with the Spanish tagger; since tag() declares IOException and the filter cannot propagate checked exceptions, the IOException is wrapped in an unchecked RuntimeException.
Source
Thrown at languagetool-language-modules/es/src/main/java/org/languagetool/language/Spanish.java:377
if (ruleMatch.getRule().getId().equals("AI_ES_GGEC_MISSING_PUNCTUATION") && suggestion.endsWith(".")) {
if (ruleMatch.getSentence().getText().replaceAll("\\s+$", "").endsWith(suggestion.substring(0,suggestion.length()-1))) {
continue;
}
}
// avoid obsolete diacritics
if (suggestionsToAvoid.contains(suggestion.toLowerCase())) {
continue;
}
// avoid lowercase at the sentence start
if (ruleMatch.getSentence().getText().trim().startsWith(StringTools.uppercaseFirstChar(suggestion))) {
continue;
}
// avoid voseo forms in suggestions
List<AnalyzedTokenReadings> atr;
try {
atr = this.getTagger().tag(Collections.singletonList(suggestion));
} catch (IOException e) {
throw new RuntimeException(e);
}
if (atr != null && atr.size()>0) {
if (atr.get(0).matchesPosTagRegex(voseoPostagPatern)) {
continue;
}
}
ruleMatch.setOriginalErrorStr();
// the suggestion only changes the casing
if (suggestion.equalsIgnoreCase(ruleMatch.getOriginalErrorStr())) {
ruleMatch.setMessage("Mayúsculas y minúsculas recomendadas.");
ruleMatch.setShortMessage("Mayúsculas y minúsculas");
ruleMatch.getRule().setLocQualityIssueType(ITSIssueType.Typographical);
ruleMatch.getRule().setCategory(Categories.CASING.getCategory(ResourceBundleTools.getMessageBundle(this)));
ruleMatch.setSpecificRuleId(ruleMatch.getRule().getId().replace("ORTHOGRAPHY", "CASING"));
//ruleMatch.getRule().setTags(Arrays.asList(Tag.picky));
}
}
results.add(ruleMatch);View on GitHub (pinned to 2e990059ce)
Solutions
- Inspect the wrapped IOException cause to identify the failing tagger resource.
- Repair/rebuild the Spanish language module so tagger dictionaries are available on the classpath.
- Check disk/IO health if the failure is transient rather than a missing resource.
Defensive patterns
Strategy: try-catch
Validate before calling
if (suggestion == null || suggestion.isBlank()) continue;
Try / catch
try {
matches = spanish.filterRuleMatches(matches, sentence);
} catch (RuntimeException e) {
if (e.getCause() instanceof IOException io) { /* log and continue with unfiltered matches */ }
} Prevention
- Deploy with the complete Spanish language module including tagger data
- Monitor for IOException causes pointing at missing resources
- Validate the installation by tagging a sample word at startup
When it happens
Trigger: Applying this filter (via filterRuleMatches) when the Spanish tagger's tag() call fails with IOException — typically missing or unreadable Spanish tagging dictionary resources for a suggestion word.
Common situations: Running with an incomplete language module build; resource loading failures in packaged deployments; corrupted Spanish dictionary data.
Understand the failure class
Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.
Related errors
- Could not tag '" + term + "'
- Could not load coherency data from " + path
- Invalid line format (DE item count != EN item count): " + li
- throw new RuntimeException(e)
- Language was already instantiated, see the cause stacktrace
AI-assisted analysis of languagetool-org/languagetool@2e990059ce (2026-09-06).
Data as JSON: /api/errors/05fade472fb9c805.
Report an issue: GitHub.