{"record":{"id":"d369ec726f715ae7","repo":"languagetool-org/languagetool","slug":"dist-to-big-maxeditdistance-d369ec","errorCode":null,"errorMessage":"Dist to big \" + maxEditDistance","messagePattern":"Dist to big \" \\+ maxEditDistance","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"languagetool-core/src/main/java/org/languagetool/rules/spelling/symspell/implementation/SymSpell.java","lineNumber":508,"sourceCode":"\n          if (consideredDeletes.add(delete)) {\n            candidates.add(delete);\n          }\n        }\n      }\n    }\n\n    //sort by ascending edit distance, then by descending word frequency\n    if (suggestions.size() > 1) {\n      Collections.sort(suggestions);\n    }\n    return suggestions;\n  }\n\n  public List<SuggestItem> lookupCompound(String input, int maxEditDistance) {\n    //parse input String into single terms\n    if (maxEditDistance > maxDictionaryEditDistance) {\n      throw new IllegalArgumentException(\"Dist to big \" + maxEditDistance);\n    }\n    String[] termList1 = parseWords(input);\n\n    List<SuggestItem> suggestions; //suggestions for a single term\n    List<SuggestItem> suggestionParts = new ArrayList<>(); // 1 line with separate parts\n    List<SuggestItem> suggestionsCombi;\n    EditDistance editDistance;\n\n    //translate every term to its best suggestion, otherwise it remains unchanged\n    boolean lastCombi = false;\n    for (int i = 0; i < termList1.length; i++) {      // For each term do loop\n      suggestions = lookup(termList1[i], Verbosity.Top, maxEditDistance); // Get the normal suggestions,\n//            suggestions.forEach(it -> System.out.println(\"Suggestions: \" + it.term));\n      //combi check, always before split. i > 0 because we can't split on zero obviously.\n      if ((i > 0) && !lastCombi) {\n        suggestionsCombi = lookup(termList1[i - 1] + termList1[i], Verbosity.Top, maxEditDistance);\n\n        if (!suggestionsCombi.isEmpty()) {","sourceCodeStart":490,"sourceCodeEnd":526,"githubUrl":"https://github.com/languagetool-org/languagetool/blob/2e990059ce67d5e2a0f7f7ca5d31160c6709df4b/languagetool-core/src/main/java/org/languagetool/rules/spelling/symspell/implementation/SymSpell.java#L490-L526","documentation":"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.","triggerScenarios":"Thrown at languagetool-core/src/main/java/org/languagetool/rules/spelling/symspell/implementation/SymSpell.java:508 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}