languagetool-org/languagetool · error · RuntimeException
IOException while synthesizing suggestions (adj-noun agreeme
Error message
IOException while synthesizing suggestions (adj-noun agreement)
What it means
TokenAgreementAdjNounRule.match() synthesizes inflected adjective suggestions with the Morfologik synthesizer; any IOException from synthesize() is wrapped in a RuntimeException and aborts the rule match. This is a runtime data-lookup failure, not a rule-logic error: the dictionary synthesizer failed while generating inflected forms for suggestions.
Source
Thrown at languagetool-language-modules/uk/src/main/java/org/languagetool/rules/uk/TokenAgreementAdjNounRule.java:334
}
for(AnalyzedToken adjToken: state.adjTokenReadings) {
String newAdjTag = adjToken.getPOSTag().replaceFirst(":.:v_...(:r(in)?anim)?", genderTag + vidmTag);
String[] synthesized = synthesizer.synthesize(adjToken, newAdjTag, false);
for (String s : synthesized) {
String suggestion = s + " " + tokenReadings.getToken();
if( ! suggestions.contains(suggestion) ) {
suggestions.add(suggestion);
}
}
}
}
} catch (IOException e) {
throw new RuntimeException(e);
}
if( msg.contains("кількісного числівника") ) {
String suggNum = state.adjAnalyzedTokenReadings.getCleanToken().replaceFirst("[-–]м[аи]$", "")
+ " " + tokenReadings.getToken();
suggestions.add(suggNum);
}
if( suggestions.size() > 0 ) {
potentialRuleMatch.setSuggestedReplacements(suggestions);
}
ruleMatches.add(potentialRuleMatch);
}
state.reset();
}
View on GitHub (pinned to 2e990059ce)
Solutions
- Inspect e.getCause() to find the underlying I/O failure (resource path, disk, permissions).
- Verify the Ukrainian synthesizer dictionary loads correctly (run a minimal synthesize call at startup as a health check).
- Rebuild/redistribute the language module jar to ensure dictionary binaries are intact.
- Catch the RuntimeException at the rule-engine integration layer and degrade to reporting the disagreement without synthesized suggestions.
- Avoid shading/repackaging jars in ways that corrupt binary dictionary entries.
Example fix
// before
} catch (IOException e) {
throw new RuntimeException(e);
}
// after
} catch (IOException e) {
LOG.warn("Synthesizer failed for adj-noun suggestions; returning agreement without suggestions", e);
return toRuleMatchUnsynthesized(msg);
} Defensive patterns
Strategy: try-catch
Validate before calling
// startup health check
try {
String[] test = synthesizer.synthesize(new AnalyzedToken("добрий", "adj:m:v_naz", "добрий"), "adj:f:v_naz", true);
if (test.length == 0) LOG.warn("Ukrainian synthesizer returned no forms");
} catch (IOException e) { throw new IllegalStateException("Synthesizer dictionary broken", e); } Try / catch
try { matchResult = rule.match(tokens); }
catch (RuntimeException e) {
if (e.getCause() instanceof IOException) { LOG.error("Suggestion synthesis failed; degrade to no-suggestion match", e); }
else throw e;
} Prevention
- Smoke-test the synthesizer at service startup
- Verify dictionary binaries in deployed jars (checksums)
- Avoid read-only/failing volumes for dictionary storage
- Degrade gracefully: report the disagreement even when suggestions can't be synthesized
When it happens
Trigger: A text is analyzed where adj-noun disagreement is detected and the rule calls synthesizer.synthesize(...) for suggestions, but the underlying dictionary stream/lookup throws IOException (broken dictionary resource, corrupt cache, I/O failure).
Common situations: Corrupted or partially extracted Morfologik dictionary in the deployed artifact; filesystem/disk errors when the dictionary is memory-mapped from disk; running LanguageTool on a read-only or failing volume.
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
- IOException while synthesizing suggestions (numr-noun agreem
- IOException while synthesizing suggestions (prep-noun agreem
- IOException while synthesizing suggestions (їх -> їхній)
- IOException while synthesizing suggestions (його/її -> нього
- IOException while synthesizing suggestions (о vocative)
AI-assisted analysis of languagetool-org/languagetool@2e990059ce (2026-09-06).
Data as JSON: /api/errors/04ea02b3c6caf666.
Report an issue: GitHub.