languagetool-org/languagetool · error

No speller rule found for

Error message

No speller rule found for 

What it means

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.

Source

Thrown at languagetool-dev/src/main/java/org/languagetool/dev/UnknownWordFinder.java:70

    for (Path file : files) {
      handle(file, lt, spellerRule, tagger);
    }
    printResult(unknownWords);
  }

  @NotNull
  private SpellingCheckRule getSpellingCheckRule(JLanguageTool lt) {
    SpellingCheckRule spellerRule = null;
    for (Rule rule : lt.getAllActiveRules()) {
      if (rule.isDictionaryBasedSpellingRule()) {
        if (spellerRule != null) {
          throw new RuntimeException("Found more than one spell rule: " + rule + ", " + spellerRule);
        }
        spellerRule = (SpellingCheckRule) rule;
      }
    }
    if (spellerRule == null) {
      throw new RuntimeException("No speller rule found for " + lt.getLanguage());
    }
    return spellerRule;
  }

  private void handle(Path f, JLanguageTool lt, SpellingCheckRule rule, Tagger tagger) throws IOException {
    String text = null;
    if (f.toString().toLowerCase().endsWith(".txt")) {
      List<String> lines = Files.readAllLines(f);
      text = String.join(" ", lines);
    } else if (f.toString().toLowerCase().endsWith(".rtf")) {
      text = getTextFromRtf(f);
    } else {
      System.out.println("Ignoring " + f + ": unknown suffix");
    }
    if (text != null) {
      System.out.println("Working on " + f);
      List<AnalyzedSentence> analyzedSentences = lt.analyzeText(text);
      for (AnalyzedSentence analyzedSentence : analyzedSentences) {

View on GitHub (pinned to 2e990059ce)

Solutions

  1. Enable the language's spelling rule (e.g. ensure the spelling rule is not disabled in configuration)
  2. Run the finder only for languages that ship a dictionary-based spelling rule
  3. Verify with lt.getAllActiveRules() that a rule with isDictionaryBasedSpellingRule()==true exists before running
Defensive patterns

Strategy: validation

Validate before calling

if (lt.getAllActiveRules().stream().noneMatch(Rule::isDictionaryBasedSpellingRule)) {
  throw new IllegalStateException("No spelling rule active for " + lt.getLanguage());
}

Try / catch

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"); } }

Prevention

When it happens

Trigger: Running UnknownWordFinder for a language that has no dictionary-based spelling rule active (spelling rule disabled, or language without such a rule).

Common situations: Languages lacking a speller rule; custom configurations that disable spelling rules; passing a language module without a spelling rule registered.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


AI-assisted analysis of languagetool-org/languagetool@2e990059ce (2026-09-06). Data as JSON: /api/errors/93f082a2068f4cdc. Report an issue: GitHub.