{"record":{"id":"ce3af0007526e50a","repo":"languagetool-org/languagetool","slug":"not-found-ce3af0","errorCode":null,"errorMessage":"Not found: ","messagePattern":"Not found: ","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"languagetool-dev/src/main/java/org/languagetool/dev/bigdata/FrequencyIndexCreator.java","lineNumber":75,"sourceCode":"  private static final int BUFFER_SIZE = 16384;\n  private static final String LT_COMPLETE_MARKER = \"languagetool_index_complete\";\n  private static final boolean IGNORE_POS = true;\n\n  private enum Mode { PlainText, Lucene }\n\n  private final AtomicLong bytesProcessed = new AtomicLong(0);\n  private final Mode mode;\n  \n  private long totalTokenCount;\n  private long inputFileCount;\n\n  public FrequencyIndexCreator(Mode mode) {\n    this.mode = mode;\n  }\n  \n  private void run(File inputDir, File indexBaseDir) throws Exception {\n    if (!inputDir.exists()) {\n      throw new RuntimeException(\"Not found: \" + inputDir);\n    }\n    List<File> files = Arrays.asList(inputDir.listFiles());\n    long totalBytes = files.stream().mapToLong(File::length).sum();\n    System.out.println(\"Total input bytes: \" + totalBytes);\n    //Collections.sort(files);  use for non-parallel streams\n    // use this to get one index per input file:\n    //files.parallelStream().forEach(dir -> index(dir, indexBaseDir, totalBytes, files.size(), null));\n    // use this to get one large index for all input files:\n    DataWriter dw;\n    if (mode == Mode.PlainText) {\n      dw = new TextDataWriter(indexBaseDir);\n    } else {\n      dw = new LuceneDataWriter(indexBaseDir);\n    }\n    try {\n      files.parallelStream().forEach(dir -> index(dir, indexBaseDir, totalBytes, files.size(), dw));\n      markIndexAsComplete(indexBaseDir);\n    } finally {","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/languagetool-org/languagetool/blob/2e990059ce67d5e2a0f7f7ca5d31160c6709df4b/languagetool-dev/src/main/java/org/languagetool/dev/bigdata/FrequencyIndexCreator.java#L57-L93","documentation":"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.","triggerScenarios":"Calling FrequencyIndexCreator.main with args[1] (inputDir) pointing to a nonexistent path; typo in the directory argument; directory not yet downloaded or mounted.","commonSituations":"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.","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"],"exampleFix":"// before\njava FrequencyIndexCreator text ./inputdata ./index   // ./inputdata does not exist\n// after\nmkdir -p /data/ngrams/input && mv *.gz /data/ngrams/input/\njava FrequencyIndexCreator text /data/ngrams/input /data/ngrams/index","handlingStrategy":"validation","validationCode":"File inputDir = new File(args[1]);\nif (!inputDir.isDirectory()) {\n  throw new IllegalArgumentException(\"Input dir missing: \" + inputDir.getAbsolutePath());\n}","typeGuard":null,"tryCatchPattern":"try {\n  creator.run(inputDir, indexBaseDir);\n} catch (RuntimeException e) {\n  System.err.println(\"Indexing failed: \" + e.getMessage());\n}","preventionTips":["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"],"tags":["file-not-found","directory","cli"],"backgroundTag":"directory-not-found","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"}