{"record":{"id":"d0940d39b299662c","repo":"languagetool-org/languagetool","slug":"dictionary-file-does-not-exist-or-is-not-a-file","errorCode":null,"errorMessage":"dictionary file does not exist or is not a file: ''","messagePattern":"dictionary file does not exist or is not a file: ''","errorType":"console","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"languagetool-server/src/main/java/org/languagetool/server/HTTPServerConfig.java","lineNumber":543,"sourceCode":"\n  private void addDynamicLanguages(Properties props) throws IOException {\n    for (Object keyObj : props.keySet()) {\n      String key = (String)keyObj;\n      if (key.startsWith(\"lang-\") && !key.contains(\"-dictPath\")) {\n        String code = key.substring(\"lang-\".length());\n        if (!code.contains(\"-\") && code.length() != 2 && code.length() != 3) {\n          throw new IllegalArgumentException(\"code is supposed to be a 2 (or rarely 3) character code (unless it uses a format with variant, like xx-YY): '\" + code + \"'\");\n        }\n        String nameKey = \"lang-\" + code;\n        String name = props.getProperty(nameKey);\n        String dictPathKey = \"lang-\" + code + \"-dictPath\";\n        String dictPath = props.getProperty(dictPathKey);\n        if (dictPath == null) {\n          throw new IllegalArgumentException(dictPathKey + \" must be set\");\n        }\n        File dictPathFile = new File(dictPath);\n        if (!dictPathFile.exists() || !dictPathFile.isFile()) {\n          throw new IllegalArgumentException(\"dictionary file does not exist or is not a file: '\" + dictPath + \"'\");\n        }\n        ServerTools.print(\"Adding dynamic spell checker language \" + name + \", code: \" + code + \", dictionary: \" + dictPath);\n        Language lang = Languages.addLanguage(name, code, new File(dictPath));\n        // better fail early in case of misconfiguration, so use the language now:\n        if (!new File(lang.getCommonWordsPath()).exists()) {\n          throw new IllegalArgumentException(\"Common words path not found: '\" + lang.getCommonWordsPath() + \"'\");\n        }\n        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);","sourceCodeStart":525,"sourceCodeEnd":561,"githubUrl":"https://github.com/languagetool-org/languagetool/blob/2e990059ce67d5e2a0f7f7ca5d31160c6709df4b/languagetool-server/src/main/java/org/languagetool/server/HTTPServerConfig.java#L525-L561","documentation":"The `lang-xx-dictPath` config property points to a path that either does not exist on disk or is a directory rather than a regular file. LanguageTool validates this eagerly while loading dynamic spell-checker languages so misconfiguration fails at startup, not per request.","triggerScenarios":"`dictPathFile.exists()` returns false or `isFile()` returns false for the value of `lang-xx-dictPath` in the server config properties.","commonSituations":"Typo in the path, dictionary file moved or deleted after config was written, relative path resolved against an unexpected working directory, or the path points to a directory containing the dictionary rather than the dictionary itself.","solutions":["Verify the path with `ls -l` and correct it in the config file","Use an absolute path instead of a relative one to avoid working-directory surprises","Point the property at the dictionary FILE itself, not its parent directory"],"exampleFix":"// before (properties)\nlang-de-dictPath=/opt/lt/dicts/\n// after (properties)\nlang-de-dictPath=/opt/lt/dicts/de.dict","handlingStrategy":"validation","validationCode":"String dictPath = props.getProperty(\"lang-de-dictPath\");\nFile f = new File(dictPath);\nif (!f.exists() || !f.isFile())\n  throw new IllegalStateException(\"Dictionary missing or not a file: \" + dictPath);","typeGuard":null,"tryCatchPattern":"try {\n  startServer(config);\n} catch (IllegalArgumentException e) {\n  LOG.error(\"Dict file problem: {}\", e.getMessage());\n}","preventionTips":["Use absolute paths for dictPath values","Verify dictionary files exist after deployment/upgrade scripts run","Point at the dictionary file itself, not a directory"],"tags":["configuration","filesystem","server"],"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"}