languagetool-org/languagetool · error · IllegalArgumentException
Dist to big " + maxEditDistance
Error message
Dist to big " + maxEditDistance
What it means
Parameter guard at the start of SymSpell.lookupCompound: the per-call maxEditDistance exceeds the edit distance the dictionary was compiled with (maxDictionaryEditDistance), so compound-aware lookups at that distance are impossible with the current index.
Source
Thrown at languagetool-core/src/main/java/org/languagetool/rules/spelling/symspell/implementation/SymSpell.java:508
if (consideredDeletes.add(delete)) {
candidates.add(delete);
}
}
}
}
//sort by ascending edit distance, then by descending word frequency
if (suggestions.size() > 1) {
Collections.sort(suggestions);
}
return suggestions;
}
public List<SuggestItem> lookupCompound(String input, int maxEditDistance) {
//parse input String into single terms
if (maxEditDistance > maxDictionaryEditDistance) {
throw new IllegalArgumentException("Dist to big " + maxEditDistance);
}
String[] termList1 = parseWords(input);
List<SuggestItem> suggestions; //suggestions for a single term
List<SuggestItem> suggestionParts = new ArrayList<>(); // 1 line with separate parts
List<SuggestItem> suggestionsCombi;
EditDistance editDistance;
//translate every term to its best suggestion, otherwise it remains unchanged
boolean lastCombi = false;
for (int i = 0; i < termList1.length; i++) { // For each term do loop
suggestions = lookup(termList1[i], Verbosity.Top, maxEditDistance); // Get the normal suggestions,
// suggestions.forEach(it -> System.out.println("Suggestions: " + it.term));
//combi check, always before split. i > 0 because we can't split on zero obviously.
if ((i > 0) && !lastCombi) {
suggestionsCombi = lookup(termList1[i - 1] + termList1[i], Verbosity.Top, maxEditDistance);
if (!suggestionsCombi.isEmpty()) {View on GitHub (pinned to 2e990059ce)
Solutions
- Pass a maxEditDistance no greater than the dictionary's maxDictionaryEditDistance
- Re-create the SymSpell instance with a higher dictionary edit distance before calling lookupCompound
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at languagetool-core/src/main/java/org/languagetool/rules/spelling/symspell/implementation/SymSpell.java:508 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of languagetool-org/languagetool@2e990059ce (2026-09-06).
Data as JSON: /api/errors/d369ec726f715ae7.
Report an issue: GitHub.