{"record":{"id":"b09008a4c7622d29","repo":"languagetool-org/languagetool","slug":"problems-with-loading-global-disambiguation-file","errorCode":null,"errorMessage":"Problems with loading global disambiguation file: \" + GLOBAL_DISAMBIGUATION_FILE","messagePattern":"Problems with loading global disambiguation file: \" \\+ GLOBAL_DISAMBIGUATION_FILE","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"languagetool-core/src/main/java/org/languagetool/tagging/disambiguation/rules/XmlRuleDisambiguator.java","lineNumber":67,"sourceCode":"    // by default, don't use global disambiguation (for now)\n    this(language, false);\n  }\n\n  public XmlRuleDisambiguator(Language language, boolean useGlobalDisambiguation) {\n    Objects.requireNonNull(language);\n    String disambiguationFile = language.getShortCode() + \"/\" + DISAMBIGUATION_FILE;\n    List<DisambiguationPatternRule> disambiguationRulesList;\n    try {\n      disambiguationRulesList = loadPatternRules(disambiguationFile, language);\n    } catch (Exception e) {\n      throw new RuntimeException(\"Problems with loading disambiguation file: \" + disambiguationFile, e);\n    }\n    if (useGlobalDisambiguation) {\n      // disambiguation-global.xml\n      try {\n        disambiguationRulesList.addAll(loadPatternRules(GLOBAL_DISAMBIGUATION_FILE, language));\n      } catch (Exception e) {\n        throw new RuntimeException(\"Problems with loading global disambiguation file: \" + GLOBAL_DISAMBIGUATION_FILE, e);\n      }\n    }\n    disambiguationRules = RuleSet.textHinted(disambiguationRulesList);\n  }\n\n  @Override\n  public AnalyzedSentence disambiguate(AnalyzedSentence input) throws IOException {\n    return disambiguate(input, null);\n  }\n\n  @Override\n  public AnalyzedSentence disambiguate(AnalyzedSentence sentence,\n      @Nullable JLanguageTool.CheckCancelledCallback checkCanceled) throws IOException {\n    for (Rule rule : disambiguationRules.rulesForSentence(sentence)) {\n      if (checkCanceled != null && checkCanceled.checkCancelled()) {\n        break;\n      }\n      sentence = ((DisambiguationPatternRule) rule).replace(sentence);","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/languagetool-org/languagetool/blob/2e990059ce67d5e2a0f7f7ca5d31160c6709df4b/languagetool-core/src/main/java/org/languagetool/tagging/disambiguation/rules/XmlRuleDisambiguator.java#L49-L85","documentation":"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.","triggerScenarios":"Thrown at languagetool-core/src/main/java/org/languagetool/tagging/disambiguation/rules/XmlRuleDisambiguator.java:67 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the wrapped cause for the XML error in disambiguation-global.xml","Ensure the global disambiguation file exists and is accessible via the data broker","Construct the disambiguator with useGlobalDisambiguation=false if global rules are not needed"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}