{"record":{"id":"a3f714354c5c109e","repo":"languagetool-org/languagetool","slug":"fasttext-model-path-not-valid-file-doesn-t-exist","errorCode":null,"errorMessage":"Fasttext model path not valid (file doesn't exist or is a directory): ","messagePattern":"Fasttext model path not valid \\(file doesn't exist or is a directory\\): ","errorType":"console","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"languagetool-server/src/main/java/org/languagetool/server/HTTPServerConfig.java","lineNumber":569,"sourceCode":"        JLanguageTool lt = new JLanguageTool(lang);\n        lt.check(\"test\");\n      }\n    }\n  }\n\n  public void setLanguageModelDirectory(String langModelDir) {\n    SuggestionsOrdererConfig.setNgramsPath(langModelDir);\n    languageModelDir = new File(langModelDir);\n    if (!languageModelDir.exists() || !languageModelDir.isDirectory()) {\n      throw new RuntimeException(\"LanguageModel directory not found or is not a directory: \" + languageModelDir);\n    }\n  }\n\n  void setFasttextPaths(String fasttextModelPath, String fasttextBinaryPath) {\n    fasttextModel = new File(fasttextModelPath);\n    fasttextBinary = new File(fasttextBinaryPath);\n    if (!fasttextModel.exists() || fasttextModel.isDirectory()) {\n      throw new RuntimeException(\"Fasttext model path not valid (file doesn't exist or is a directory): \" + fasttextModelPath);\n    }\n    if (!fasttextBinary.exists() || fasttextBinary.isDirectory() || !fasttextBinary.canExecute()) {\n      throw new RuntimeException(\"Fasttext binary path not valid (file doesn't exist, is a directory or not executable): \" + fasttextBinaryPath);\n    }\n  }\n\n  /*\n   * @param verbose if true, the text to be checked will be displayed in case of exceptions\n   */\n  public boolean isVerbose() {\n    return verbose;\n  }\n\n  public boolean isPublicAccess() {\n    return publicAccess;\n  }\n\n  public int getPort() {","sourceCodeStart":551,"sourceCodeEnd":587,"githubUrl":"https://github.com/languagetool-org/languagetool/blob/2e990059ce67d5e2a0f7f7ca5d31160c6709df4b/languagetool-server/src/main/java/org/languagetool/server/HTTPServerConfig.java#L551-L587","documentation":"setFasttextPaths configures the fasttext model used for language detection. A RuntimeException is thrown when the model path does not exist or is a directory — the model must be an existing regular file (typically lid.176.bin).","triggerScenarios":"Calling setFasttextPaths(modelPath, binaryPath) (or the --fasttextModel server option) with a modelPath that is missing, mistyped, or points to a directory.","commonSituations":"fasttext model not downloaded, path pointing at the containing directory, wrong filename (e.g. lid.176.ftz vs lid.176.bin confusion), or relative path resolved against the wrong working directory.","solutions":["Download the fasttext language-identification model (e.g. lid.176.bin) and pass its full file path","Verify the file exists and is not a directory: `ls -l <modelPath>`","Use an absolute path in the --fasttextModel option"],"exampleFix":"// before\n--fasttextModel /opt/fasttext/models\n// after\n--fasttextModel /opt/fasttext/models/lid.176.bin","handlingStrategy":"validation","validationCode":"File model = new File(fasttextModelPath);\nif (!model.isFile())\n  throw new IllegalStateException(\"fasttext model missing: \" + fasttextModelPath);","typeGuard":null,"tryCatchPattern":"try {\n  config.setFasttextPaths(modelPath, binaryPath);\n} catch (RuntimeException e) {\n  LOG.error(\"fasttext model invalid: {}\", e.getMessage());\n}","preventionTips":["Download lid.176.bin (or equivalent) before enabling language detection","Use absolute file paths, not directories","Verify model file presence in deployment health checks"],"tags":["configuration","filesystem","fasttext"],"backgroundTag":"file-not-found","analyzedSha":"2e990059ce67d5e2a0f7f7ca5d31160c6709df4b","analyzedAt":"2026-09-06T09:20:17.015Z","contentChangedAt":"2026-09-06T09:20:17.015Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}