{"record":{"id":"8af6ab70d31cd2fd","repo":"stanfordnlp/CoreNLP","slug":"failure-to-load-language-specific-properties","errorCode":null,"errorMessage":"Failure to load language specific properties: ","messagePattern":"Failure to load language specific properties: ","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/pipeline/StanfordCoreNLPServer.java","lineNumber":538,"sourceCode":"      String languagePropertiesFile = LanguageInfo.getLanguagePropertiesFile(language);\n      if (languagePropertiesFile != null) {\n        try (BufferedReader is = IOUtils.readerFromString(languagePropertiesFile)){\n          Properties languageSpecificProperties = new Properties();\n          languageSpecificProperties.load(is);\n          PropertiesUtils.overWriteProperties(props,languageSpecificProperties);\n          // don't enforce requirements for non-English\n          if ( ! LanguageInfo.HumanLanguage.ENGLISH.equals(LanguageInfo.getLanguageFromString(language))) {\n            props.setProperty(\"enforceRequirements\", \"false\");\n          }\n          // check if the server is set to use the srparser, and if so,\n          // set the parse.model to be srparser.model\n          // also, check properties for the srparser.model prop\n          // perhaps some languages don't have a default set for that\n          if (srparser && languageSpecificProperties.containsKey(\"srparser.model\")) {\n            props.setProperty(\"parse.model\", languageSpecificProperties.getProperty(\"srparser.model\"));\n          }\n        } catch (IOException e) {\n          err(\"Failure to load language specific properties: \" + languagePropertiesFile + \" for \" + language);\n        }\n      } else {\n        try {\n          respondError(\"Invalid language: '\" + language + '\\'', httpExchange);\n        } catch (IOException e) { warn(e); }\n        return new Properties();\n      }\n    }\n\n    // (tweak the default properties a bit)\n    if (!props.containsKey(\"mention.type\")) {\n      // Set coref head to use dependencies\n      props.setProperty(\"mention.type\", \"dep\");\n      if (urlProperties.containsKey(\"annotators\") && urlProperties.get(\"annotators\") != null &&\n          ArrayUtils.contains(urlProperties.get(\"annotators\").split(\",\"), \"parse\")) {\n        // (case: the properties have a parse annotator --\n        //        we don't have to use the dependency mention finder)\n        props.remove(\"mention.type\");","sourceCodeStart":520,"sourceCodeEnd":556,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/pipeline/StanfordCoreNLPServer.java#L520-L556","documentation":"StanfordCoreNLPServer logs this when it fails to read the language-specific default properties file (e.g. Spanish, French) that it tries to merge into the request's properties. The IOException comes from opening/reading the language properties resource on the classpath. The server continues with the base properties, so requested language defaults (models, srparser.model, etc.) are silently missing and downstream annotators may fail to load.","triggerScenarios":"Calling the server's / (or /tokens, etc.) endpoint with a language=xx parameter whose default properties file (StanfordCoreNLPServer default props for that language, e.g. StanfordCoreNLP.properties for Spanish) cannot be found or read in getProperties().","commonSituations":"Running the server jar without the models jar for the requested language on the classpath; typo in the language code (e.g. language=es-mx when only 'es' ships); custom CoreNLP distribution missing lang resources; fat-jar packaging that excluded language resource folders.","solutions":["Add the language-specific models jar (e.g. stanford-corenlp-4.x-models.jar or the per-language models jar) to the server's classpath.","Verify the language code matches a supported language whose properties file exists under edu/stanford/nlp/pipeline/ (check with unzip -l on the jar).","Log/inspect the wrapped IOException and languagePropertiesFile path to confirm whether the resource is absent or unreadable.","If the language's defaults are truly unneeded, pass full explicit properties in the request so the language lookup path is not required."],"exampleFix":"// before: server started with only core jar, request uses language=fr\njava -cp stanford-corenlp.jar edu.stanford.nlp.pipeline.StanfordCoreNLPServer\n// after: include language models\nclasspath=$(ls stanford-corenlp-*.jar):$(ls stanford-corenlp-*-models*.jar)\njava -mx4g -cp \"$classpath\" edu.stanford.nlp.pipeline.StanfordCoreNLPServer -port 9000","handlingStrategy":"validation","validationCode":"String lang = requestParams.getOrDefault(\"language\", \"en\");\nString res = \"edu/stanford/nlp/pipeline/StanfordCoreNLP\" + lang + \".properties\";\nif (getClass().getClassLoader().getResource(res) == null) {\n    throw new IllegalStateException(\"Language properties not on classpath: \" + res);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ship the models jar for every language you request.","Smoke-test each language with a /ready plus sample-annotate request after deployment.","Send explicit full properties when language defaults are not needed."],"tags":["java","server","classpath","i18n","resource-loading"],"backgroundTag":"file-read-failed","analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}