languagetool-org/languagetool · error

Not found:

Error message

Not found: 

What it means

FrequencyIndexCreator.run validates that the input directory of n-gram data exists before building a Lucene frequency index. If the given path does not exist it throws this RuntimeException. The tool cannot proceed without the Google Books n-gram style input files.

Source

Thrown at languagetool-dev/src/main/java/org/languagetool/dev/bigdata/FrequencyIndexCreator.java:75

  private static final int BUFFER_SIZE = 16384;
  private static final String LT_COMPLETE_MARKER = "languagetool_index_complete";
  private static final boolean IGNORE_POS = true;

  private enum Mode { PlainText, Lucene }

  private final AtomicLong bytesProcessed = new AtomicLong(0);
  private final Mode mode;
  
  private long totalTokenCount;
  private long inputFileCount;

  public FrequencyIndexCreator(Mode mode) {
    this.mode = mode;
  }
  
  private void run(File inputDir, File indexBaseDir) throws Exception {
    if (!inputDir.exists()) {
      throw new RuntimeException("Not found: " + inputDir);
    }
    List<File> files = Arrays.asList(inputDir.listFiles());
    long totalBytes = files.stream().mapToLong(File::length).sum();
    System.out.println("Total input bytes: " + totalBytes);
    //Collections.sort(files);  use for non-parallel streams
    // use this to get one index per input file:
    //files.parallelStream().forEach(dir -> index(dir, indexBaseDir, totalBytes, files.size(), null));
    // use this to get one large index for all input files:
    DataWriter dw;
    if (mode == Mode.PlainText) {
      dw = new TextDataWriter(indexBaseDir);
    } else {
      dw = new LuceneDataWriter(indexBaseDir);
    }
    try {
      files.parallelStream().forEach(dir -> index(dir, indexBaseDir, totalBytes, files.size(), dw));
      markIndexAsComplete(indexBaseDir);
    } finally {

View on GitHub (pinned to 2e990059ce)

Solutions

  1. Check the input directory path passed as the second CLI argument exists (ls it before running)
  2. Fix typos or relative-path issues by passing an absolute path
  3. Download/extract the n-gram dataset into the expected directory first
  4. Swap args if inputDir and indexBaseDir were accidentally reversed

Example fix

// before
java FrequencyIndexCreator text ./inputdata ./index   // ./inputdata does not exist
// after
mkdir -p /data/ngrams/input && mv *.gz /data/ngrams/input/
java FrequencyIndexCreator text /data/ngrams/input /data/ngrams/index
Defensive patterns

Strategy: validation

Validate before calling

File inputDir = new File(args[1]);
if (!inputDir.isDirectory()) {
  throw new IllegalArgumentException("Input dir missing: " + inputDir.getAbsolutePath());
}

Try / catch

try {
  creator.run(inputDir, indexBaseDir);
} catch (RuntimeException e) {
  System.err.println("Indexing failed: " + e.getMessage());
}

Prevention

When it happens

Trigger: Calling FrequencyIndexCreator.main with args[1] (inputDir) pointing to a nonexistent path; typo in the directory argument; directory not yet downloaded or mounted.

Common situations: Wrong CLI argument order (index dir given as input dir); running from a different working directory with a relative path; dataset deleted after a previous run.

Related errors


AI-assisted analysis of languagetool-org/languagetool@2e990059ce (2026-09-06). Data as JSON: /api/errors/ce3af0007526e50a. Report an issue: GitHub.