{"record":{"id":"3dcbbbbe30d642c3","repo":"stanfordnlp/CoreNLP","slug":"couldn-t-load-neutralwordsfile","errorCode":null,"errorMessage":"Couldn't load {neutralWordsFile}","messagePattern":"Couldn't load (.+?)","errorType":"exception","errorClass":"RuntimeIOException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/dcoref/Dictionaries.java","lineNumber":390,"sourceCode":"        countries.add(line.split(\"\\t\")[1].toLowerCase());\n      }\n    } catch (IOException e) {\n      throw new RuntimeIOException(e);\n    }\n  }\n\n  /**\n   * Load Bergsma and Lin (2006) gender and number list.\n   * <br>\n   * The list is converted from raw text and numbers to a serialized\n   * map, which saves quite a bit of time loading.\n   * See edu.stanford.nlp.dcoref.util.ConvertGenderFile\n   */\n  private void loadGenderNumber(String file, String neutralWordsFile) {\n    try {\n      getWordsFromFile(neutralWordsFile, neutralWords, false);\n    } catch (IOException e) {\n      throw new RuntimeIOException(\"Couldn't load \" + neutralWordsFile);\n    }\n    try {\n      Map<List<String>, Gender> temp = IOUtils.readObjectFromURLOrClasspathOrFileSystem(file);\n      genderNumber.putAll(temp);\n    } catch (IOException | ClassNotFoundException e) {\n      throw new RuntimeIOException(\"Couldn't load \" + file);\n    }\n  }\n\n  private static void loadCorefDict(String[] file,\n      ArrayList<Counter<Pair<String, String>>> dict) {\n\n    for(int i = 0; i < 4; i++){\n      dict.add(new ClassicCounter<>());\n\n      BufferedReader reader = null;\n      try {\n        reader = IOUtils.readerFromString(file[i]);","sourceCodeStart":372,"sourceCodeEnd":408,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/dcoref/Dictionaries.java#L372-L408","documentation":"loadGenderNumber wraps failures reading the neutral-words list into RuntimeIOException with the message \"Couldn't load <neutralWordsFile>\". It signals the gender/number neutral-word resource could not be read while initializing dcoref dictionaries.","triggerScenarios":"Constructing Dictionaries when getWordsFromFile throws IOException for the neutralWordsFile path (missing file, bad URL, permission denied).","commonSituations":"Missing CoreNLP models jar, wrong gender/number file properties, deployment strips resource files, or network URL unreachable when a URL path is configured.","solutions":["Check the neutral words file path/property value and confirm the file exists","Ensure the CoreNLP models jar is on the classpath","Use classpath:/ URLs for built-in resources instead of bare relative paths","Confirm read permissions and correct working directory"],"exampleFix":"// before\nprops.setProperty(\"coref.gender.neutral\", \"neutralWords.txt\");\n// after\nprops.setProperty(\"coref.gender.neutral\", \"classpath:/edu/stanford/nlp/models/dcoref/neutral.words\");","handlingStrategy":"try-catch","validationCode":"String p = props.getProperty(\"coref.gender.neutral\");\nif (p != null && !IOUtils.existsInClasspathOrFileSystem(p)) {\n    throw new IllegalStateException(\"Neutral words file not found: \" + p);\n}","typeGuard":null,"tryCatchPattern":"try {\n    new Dictionaries(props);\n} catch (RuntimeIOException e) {\n    if (e.getMessage() != null && e.getMessage().startsWith(\"Couldn't load\")) {\n        log.error(\"Gender/number resource missing: \" + e.getMessage());\n    }\n    throw e;\n}","preventionTips":["Ensure the CoreNLP models jar is on the classpath","Use classpath:/ URLs for bundled dcoref resources","Check read permissions on configured files","Fail fast with pre-startup resource checks"],"tags":["io","java","corenlp","resource-loading"],"backgroundTag":"file-not-found","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"}