languagetool-org/languagetool · error · RuntimeException

Problems with loading disambiguation file: " + disambiguatio

Error message

Problems with loading disambiguation file: " + disambiguationFile

What it means

Wraps any exception raised while loading and parsing the language's disambiguation.xml into DisambiguationPatternRules during XmlRuleDisambiguator construction. It signals the disambiguation rule set is unavailable — missing resource, SAX parse error, or invalid rule semantics — so the language's disambiguator cannot be created.

Source

Thrown at languagetool-core/src/main/java/org/languagetool/tagging/disambiguation/rules/XmlRuleDisambiguator.java:60

  private static final String DISAMBIGUATION_FILE = "disambiguation.xml";
  private static final String GLOBAL_DISAMBIGUATION_FILE = "disambiguation-global.xml";

  private final RuleSet disambiguationRules;
  
  public XmlRuleDisambiguator(Language language) {
    // by default, don't use global disambiguation (for now)
    this(language, false);
  }

  public XmlRuleDisambiguator(Language language, boolean useGlobalDisambiguation) {
    Objects.requireNonNull(language);
    String disambiguationFile = language.getShortCode() + "/" + DISAMBIGUATION_FILE;
    List<DisambiguationPatternRule> disambiguationRulesList;
    try {
      disambiguationRulesList = loadPatternRules(disambiguationFile, language);
    } catch (Exception e) {
      throw new RuntimeException("Problems with loading disambiguation file: " + disambiguationFile, e);
    }
    if (useGlobalDisambiguation) {
      // disambiguation-global.xml
      try {
        disambiguationRulesList.addAll(loadPatternRules(GLOBAL_DISAMBIGUATION_FILE, language));
      } catch (Exception e) {
        throw new RuntimeException("Problems with loading global disambiguation file: " + GLOBAL_DISAMBIGUATION_FILE, e);
      }
    }
    disambiguationRules = RuleSet.textHinted(disambiguationRulesList);
  }

  @Override
  public AnalyzedSentence disambiguate(AnalyzedSentence input) throws IOException {
    return disambiguate(input, null);
  }

  @Override

View on GitHub (pinned to 2e990059ce)

Solutions

  1. Inspect the wrapped cause for the specific XML parse or rule error and its line number
  2. Ensure <shortCode>/disambiguation.xml exists in the language resource directory and is valid UTF-8 XML
  3. Validate the XML against the disambiguation rules schema before shipping
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at languagetool-core/src/main/java/org/languagetool/tagging/disambiguation/rules/XmlRuleDisambiguator.java:60 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/034944b681a3052a. Report an issue: GitHub.