languagetool-org/languagetool · error · RuntimeException

Problems with loading global disambiguation file: " + GLOBAL

Error message

Problems with loading global disambiguation file: " + GLOBAL_DISAMBIGUATION_FILE

What it means

Same wrapping as the per-language variant but for disambiguation-global.xml, loaded when useGlobalDisambiguation is true. The shared global disambiguation rule file could not be read or parsed, so construction of the disambiguator fails rather than silently skipping global rules.

Source

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

    // 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
  public AnalyzedSentence disambiguate(AnalyzedSentence sentence,
      @Nullable JLanguageTool.CheckCancelledCallback checkCanceled) throws IOException {
    for (Rule rule : disambiguationRules.rulesForSentence(sentence)) {
      if (checkCanceled != null && checkCanceled.checkCancelled()) {
        break;
      }
      sentence = ((DisambiguationPatternRule) rule).replace(sentence);

View on GitHub (pinned to 2e990059ce)

Solutions

  1. Check the wrapped cause for the XML error in disambiguation-global.xml
  2. Ensure the global disambiguation file exists and is accessible via the data broker
  3. Construct the disambiguator with useGlobalDisambiguation=false if global rules are not needed
Defensive patterns

Strategy: fallback

When it happens

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