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
- Check the input directory path passed as the second CLI argument exists (ls it before running)
- Fix typos or relative-path issues by passing an absolute path
- Download/extract the n-gram dataset into the expected directory first
- 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
- Always pass absolute paths for inputDir and indexBaseDir
- Verify the dataset is downloaded and extracted before indexing
- Don't confuse the order of the two directory arguments
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
- <dir.getAbsolutePath()> is not a directory, cannot use recur
- File not found or isn't a file: ${propFile.getAbsolutePath()
- File not found or isn't a file: ${disabledRulesPropFile.getA
- WrongParameterNumberException
- Unknown level '<level>' - currently, only 'PICKY' is support
AI-assisted analysis of languagetool-org/languagetool@2e990059ce (2026-09-06).
Data as JSON: /api/errors/ce3af0007526e50a.
Report an issue: GitHub.