{"record":{"id":"17093e74ee1186ab","repo":"languagetool-org/languagetool","slug":"must-be-set","errorCode":null,"errorMessage":" must be set","messagePattern":" must be set","errorType":"console","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"languagetool-server/src/main/java/org/languagetool/server/HTTPServerConfig.java","lineNumber":539,"sourceCode":"    } catch (IOException e) {\n      throw new RuntimeException(\"Could not load properties from '\" + file + \"'\", e);\n    }\n  }\n\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) {","sourceCodeStart":521,"sourceCodeEnd":557,"githubUrl":"https://github.com/languagetool-org/languagetool/blob/2e990059ce67d5e2a0f7f7ca5d31160c6709df4b/languagetool-server/src/main/java/org/languagetool/server/HTTPServerConfig.java#L521-L557","documentation":"When a dynamic language `lang-xx` property is defined, LanguageTool requires a companion property `lang-xx-dictPath` pointing at the hunspell/morfologik dictionary file for that language's spell checker. This IllegalArgumentException is thrown when that dictPath property is missing from the config.","triggerScenarios":"A config properties file defines `lang-xx=Some Language` (or a valid `lang-xx*` key) but no `lang-xx-dictPath=...` entry exists in the same Properties object.","commonSituations":"Admins add a custom language entry but forget the `-dictPath` companion property, or misspell it (e.g. `lang-de-dictpath` with wrong case or `-dictionary` instead of `-dictPath`).","solutions":["Add the missing property, e.g. `lang-de-dictPath=/path/to/de.dict` next to the `lang-de` entry","Check exact spelling/casing of the property key suffix: it must be exactly `-dictPath`","Remove the `lang-xx` entry entirely if no custom language was intended"],"exampleFix":"// before (properties)\nlang-de=German (custom)\n// after (properties)\nlang-de=German (custom)\nlang-de-dictPath=/opt/languagetool/dicts/de.dict","handlingStrategy":"validation","validationCode":"for (String key : props.stringPropertyNames()) {\n  if (key.startsWith(\"lang-\") && !key.endsWith(\"-dictPath\")) {\n    String code = key.substring(\"lang-\".length());\n    if (!props.containsKey(\"lang-\" + code + \"-dictPath\"))\n      throw new IllegalStateException(\"Missing lang-\" + code + \"-dictPath\");\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  serverConfig.checkConsistency();\n} catch (IllegalArgumentException e) {\n  LOG.error(\"Invalid dynamic language config: {}\", e.getMessage());\n  System.exit(1);\n}","preventionTips":["Define lang-xx and lang-xx-dictPath together, never separately","Keep exact casing of the -dictPath suffix","Validate config files in CI before deploying the server"],"tags":["configuration","server","missing-property"],"backgroundTag":"missing-required-config-field","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"}