languagetool-org/languagetool · error · RuntimeException

Could not load dictionary

Error message

Could not load dictionary

What it means

Wrapper exception in BaseSynthesizer.createStemmer: opening the Morfologik dictionary for the synthesizer failed with an IOException (missing, corrupt, or unreadable dictionary resource), which is rethrown as a RuntimeException. The chained cause carries the underlying I/O problem; the resource at fault is the synthesizer's dictionary file.

Source

Thrown at languagetool-core/src/main/java/org/languagetool/synthesis/BaseSynthesizer.java:158

        dict = this.dictionary;
        if (dict == null) {
          dictionary = dict = MorfologikSpeller.getDictionaryWithCaching(resourceFileName);
        }
      }
    }
    return dict;
  }

  /**
   * Creates a new {@link IStemmer} based on the configured {@link #getDictionary() dictionary}.
   * The result must not be shared among threads.
   * @since 2.3
   */
  protected IStemmer createStemmer() {
    try {
      return new DictionaryLookup(getDictionary());
    } catch (IOException e) {
      throw new RuntimeException("Could not load dictionary", e);
    }
  }
  
  private Soros createNumberSpeller(String langcode) {
    Soros s;
    try {
      URL url = JLanguageTool.getDataBroker().getFromResourceDirAsUrl(sorosFileName);
      BufferedReader f = new BufferedReader(new InputStreamReader(url.openStream(), StandardCharsets.UTF_8));
      StringBuilder sb = new StringBuilder();
      String line;
      while ((line = f.readLine()) != null) {
        sb.append(line);
        sb.append('\n');
      }
      s = new Soros(new String(sb), langcode);
    } catch (Exception e) {
      return null;
    }

View on GitHub (pinned to 2e990059ce)

Solutions

  1. Check the chained IOException cause for the real reason (file missing, wrong path, corrupt data)
  2. Verify the synthesizer's dictionary resource exists and is bundled with the language module
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at languagetool-core/src/main/java/org/languagetool/synthesis/BaseSynthesizer.java:158 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/79f6b33ab5d03a64. Report an issue: GitHub.