languagetool-org/languagetool · error · RuntimeException

Cannot read file: ${dictFile.getAbsolutePath()}

Error message

Cannot read file: ${dictFile.getAbsolutePath()}

What it means

I/O guard in DictionaryBuilder.addFreqData: reading the (decompiled) dictionary file to re-embed frequency data failed; the input at fault is the dictFile being rewritten.

Source

Thrown at languagetool-tools/src/main/java/org/languagetool/tools/DictionaryBuilder.java:192

            double freqZeroToOne = Math.log(freq) / maxFreqLog;  // spread number better over the range
            normalizedFreq = (int) (freqZeroToOne * (FREQ_RANGES_IN-1));  // 0 to 255
          }
          if (normalizedFreq < 0 || normalizedFreq > 255) {
            throw new RuntimeException("Frequency out of range (0-255): " + normalizedFreq + " in word " + key);
          }
          // Convert integers 0-255 to ranges A-Z, and write output 
          String freqChar = Character.toString((char) (FIRST_RANGE_CODE + normalizedFreq*FREQ_RANGES_OUT/FREQ_RANGES_IN));
          //add separator only in speller dictionaries
          if (useSeparator) { 
            bw.write(line + separator + freqChar + "\n");  
          } else {
            bw.write(line + freqChar + "\n");
          }
        }
      }
      System.out.println(freqList.size() + " frequency values applied to " + freqValuesApplied + " word forms.");
    } catch (IOException e) {
      throw new RuntimeException("Cannot read file: " + dictFile.getAbsolutePath());
    }
    return tempFile;
  }
  
  protected File convertTabToSeparator(File inputFile) throws RuntimeException, IOException {
    File outputFile = File.createTempFile(
        DictionaryBuilder.class.getSimpleName() + "_separator", ".txt");
    outputFile.deleteOnExit();

    String separator = getOption("fsa.dict.separator");
    if (separator == null || separator.trim().isEmpty()) {
      throw new IOException(
          "A separator character (fsa.dict.separator) must be defined in the dictionary info file.");
    }
    String encoding = getOption("fsa.dict.encoding");
    try (Scanner scanner = new Scanner(inputFile, encoding);
         Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outputFile), encoding))) {
      while (scanner.hasNextLine()) {

View on GitHub (pinned to 2e990059ce)

Solutions

  1. Verify dictFile exists and is readable/writable
  2. Check disk space and permissions in the output directory
  3. Re-run the earlier build steps that produce dictFile if it was deleted
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at languagetool-tools/src/main/java/org/languagetool/tools/DictionaryBuilder.java:192 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/16e5026dca4a79b6. Report an issue: GitHub.