languagetool-org/languagetool · error · RuntimeException

No rules are active. Please make sure your rule ids (<option

Error message

No rules are active. Please make sure your rule ids (<options.getEnabledRules()>) and category ids (<catIds>) are correct

What it means

After building the JLanguageTool instance and applying enabled/disabled rules, main() checks that at least one rule is active. If getAllActiveRules() is empty it throws with this message listing the enabled rule ids and category ids. It guards against running with a configuration that would check nothing.

Source

Thrown at languagetool-commandline/src/main/java/org/languagetool/commandline/Main.java:434

        System.err.println("No language specified, using English (no spell checking active, " +
                "specify a language variant like 'en-GB' if available)");
      }
      options.setLanguage(new English());
    } else if (!options.isApplySuggestions()) {
      languageHint = "Expected text language: " + options.getLanguage().getName();
    }
    options.getLanguage().getSentenceTokenizer().setSingleLineBreaksMarksParagraph(
            options.isSingleLineBreakMarksParagraph());
    Main prg = new Main(options);
    if (options.getFalseFriendFile() != null) {
      List<AbstractPatternRule> ffRules = prg.lt.loadFalseFriendRules(options.getFalseFriendFile());
      for (AbstractPatternRule ffRule : ffRules) {
        prg.lt.addRule(ffRule);
      }
    }
    if (prg.lt.getAllActiveRules().isEmpty()) {
      List<String> catIds = options.getEnabledCategories().stream().map(i -> i.toString()).collect(Collectors.toList());
      throw new RuntimeException("No rules are active. Please make sure your rule ids " +
              "(" + options.getEnabledRules() + ") and " +
              "category ids (" + catIds + ") are correct");
    }
    if (languageHint != null) {
      String spellHint = "";
      if (!prg.isSpellCheckingActive()) {
        if (prg.lt.getLanguage().isVariant()) {
          spellHint = " (no spell checking active)";
        } else {
          spellHint = " (no spell checking active, specify a language variant like 'en-GB' if available)";
        }
      }
      System.err.println(languageHint + spellHint);
    }
    prg.setListUnknownWords(options.isListUnknown());
    if (options.isProfile()) {
      prg.setProfilingMode();
    }

View on GitHub (pinned to 2e990059ce)

Solutions

  1. Print available rules with `languagetool -l <lang> --list` and match ids exactly (case-sensitive).
  2. Remove the --enable values to fall back to the language's default active rules.
  3. Verify category ids as well as rule ids; a wrong category with rules can also yield an empty set.
  4. Check you are not simultaneously disabling the rules you enabled (--disable overrides).

Example fix

// before
languagetool -l de --enable EN_A_VS_AN file.txt
// after
languagetool -l en-US --enable EN_A_VS_AN file.txt
Defensive patterns

Strategy: validation

Validate before calling

Language lang = Languages.getLanguageForShortCode("en-US");
try (JLanguageTool lt = new JLanguageTool(lang)) {
  Tools.selectRules(lt, disabled, enabled, true);
  if (lt.getAllActiveRules().isEmpty()) {
    throw new IllegalStateException("Configuration enables no rules for " + lang);
  }
}

Try / catch

if (lt.getAllActiveRules().isEmpty()) {
  System.err.println("No active rules; check --enable ids against 'languagetool --list'");
  System.exit(2);
}

Prevention

When it happens

Trigger: Passing --enable ids (rules or categories via --enablecategories-equivalent options) that match no rules of the selected language, or disabling everything so no active rules remain.

Common situations: Typo in a rule id (case-sensitive); enabling a rule that belongs to a different language; enabling only rules hidden behind a premium/remote configuration; disabling all default categories.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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