{"record":{"id":"93f082a2068f4cdc","repo":"languagetool-org/languagetool","slug":"no-speller-rule-found-for","errorCode":null,"errorMessage":"No speller rule found for ","messagePattern":"No speller rule found for ","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"languagetool-dev/src/main/java/org/languagetool/dev/UnknownWordFinder.java","lineNumber":70,"sourceCode":"    for (Path file : files) {\n      handle(file, lt, spellerRule, tagger);\n    }\n    printResult(unknownWords);\n  }\n\n  @NotNull\n  private SpellingCheckRule getSpellingCheckRule(JLanguageTool lt) {\n    SpellingCheckRule spellerRule = null;\n    for (Rule rule : lt.getAllActiveRules()) {\n      if (rule.isDictionaryBasedSpellingRule()) {\n        if (spellerRule != null) {\n          throw new RuntimeException(\"Found more than one spell rule: \" + rule + \", \" + spellerRule);\n        }\n        spellerRule = (SpellingCheckRule) rule;\n      }\n    }\n    if (spellerRule == null) {\n      throw new RuntimeException(\"No speller rule found for \" + lt.getLanguage());\n    }\n    return spellerRule;\n  }\n\n  private void handle(Path f, JLanguageTool lt, SpellingCheckRule rule, Tagger tagger) throws IOException {\n    String text = null;\n    if (f.toString().toLowerCase().endsWith(\".txt\")) {\n      List<String> lines = Files.readAllLines(f);\n      text = String.join(\" \", lines);\n    } else if (f.toString().toLowerCase().endsWith(\".rtf\")) {\n      text = getTextFromRtf(f);\n    } else {\n      System.out.println(\"Ignoring \" + f + \": unknown suffix\");\n    }\n    if (text != null) {\n      System.out.println(\"Working on \" + f);\n      List<AnalyzedSentence> analyzedSentences = lt.analyzeText(text);\n      for (AnalyzedSentence analyzedSentence : analyzedSentences) {","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/languagetool-org/languagetool/blob/2e990059ce67d5e2a0f7f7ca5d31160c6709df4b/languagetool-dev/src/main/java/org/languagetool/dev/UnknownWordFinder.java#L52-L88","documentation":"UnknownWordFinder.getSpellingCheckRule also requires at least one dictionary-based spelling rule among the active rules; if none exists it throws a RuntimeException naming the language. The tool cannot detect unknown words without a speller rule to hook into.","triggerScenarios":"Running UnknownWordFinder for a language that has no dictionary-based spelling rule active (spelling rule disabled, or language without such a rule).","commonSituations":"Languages lacking a speller rule; custom configurations that disable spelling rules; passing a language module without a spelling rule registered.","solutions":["Enable the language's spelling rule (e.g. ensure the spelling rule is not disabled in configuration)","Run the finder only for languages that ship a dictionary-based spelling rule","Verify with lt.getAllActiveRules() that a rule with isDictionaryBasedSpellingRule()==true exists before running"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (lt.getAllActiveRules().stream().noneMatch(Rule::isDictionaryBasedSpellingRule)) {\n  throw new IllegalStateException(\"No spelling rule active for \" + lt.getLanguage());\n}","typeGuard":null,"tryCatchPattern":"try { new UnknownWordFinder(...).run(); } catch (RuntimeException e) { if (e.getMessage().startsWith(\"No speller rule found\")) { System.err.println(\"Enable a spelling rule for this language or skip it\"); } }","preventionTips":["Check languages have a dictionary-based spelling rule before running","Avoid configs that disable all spelling rules","Skip languages without speller rules in batch scripts"],"tags":["spelling","rules","dev-tool"],"backgroundTag":"empty-result-set","analyzedSha":"2e990059ce67d5e2a0f7f7ca5d31160c6709df4b","analyzedAt":"2026-09-06T09:20:17.015Z","contentChangedAt":"2026-09-06T09:20:17.015Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}