{"record":{"id":"134dbc2cf5779352","repo":"languagetool-org/languagetool","slug":"common-words-path-not-found","errorCode":null,"errorMessage":"Common words path not found: ''","messagePattern":"Common words path not found: ''","errorType":"console","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"languagetool-server/src/main/java/org/languagetool/server/HTTPServerConfig.java","lineNumber":549,"sourceCode":"        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);\n    }\n  }\n\n  void setFasttextPaths(String fasttextModelPath, String fasttextBinaryPath) {\n    fasttextModel = new File(fasttextModelPath);\n    fasttextBinary = new File(fasttextBinaryPath);","sourceCodeStart":531,"sourceCodeEnd":567,"githubUrl":"https://github.com/languagetool-org/languagetool/blob/2e990059ce67d5e2a0f7f7ca5d31160c6709df4b/languagetool-server/src/main/java/org/languagetool/server/HTTPServerConfig.java#L531-L567","documentation":"After registering a dynamic language, LanguageTool proactively instantiates a JLanguageTool and checks whether the language's 'common words' file (auto-derived from the language code/dictionary) exists, failing early with this IllegalArgumentException if it does not.","triggerScenarios":"`lang.getCommonWordsPath()` returns a path that does not exist after `Languages.addLanguage(name, code, new File(dictPath))` succeeds — typically because the dictionary file is malformed or the derived common-words location was never created.","commonSituations":"Custom dictionary file in the wrong format so the derived `hunspell/<code>/` common-words path is absent, wrong language code causing paths under a non-existent resource directory, or an incomplete LanguageTool installation.","solutions":["Check the path in the message and create/populate the expected common-words file (typically via extract of an org.languagetool language resource layout)","Verify the dictPath file is a valid hunspell/morfologik dictionary for the given language code","Run a `lt.check(\"test\")` setup manually to surface the underlying resource-loading error"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"Language lang = Languages.addLanguage(name, code, dictFile);\nif (!new File(lang.getCommonWordsPath()).exists()) {\n  throw new IllegalStateException(\"Common words file missing: \" + lang.getCommonWordsPath());\n}","typeGuard":null,"tryCatchPattern":"try {\n  config.addDynamicLanguages(props);\n} catch (IllegalArgumentException | IOException e) {\n  LOG.error(\"Dynamic language setup failed: {}\", e.getMessage());\n}","preventionTips":["Ship the complete expected resource layout (common words file) with custom dictionaries","Double-check the language code used — it drives the derived resource paths","Test dynamic language registration in a staging startup before production"],"tags":["configuration","filesystem","server"],"backgroundTag":"resource-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"}