{"record":{"id":"1c70783c2967df51","repo":"stanfordnlp/CoreNLP","slug":"missing-property-name","errorCode":null,"errorMessage":"Missing property: \"${name}\"","messagePattern":"Missing property: \"(.+?)\"","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"critical","filePath":"src/edu/stanford/nlp/pipeline/StanfordCoreNLP.java","lineNumber":400,"sourceCode":"   *\n   * @return A class which specifies the actual implementation of each of the annotators called\n   *         when creating the annotator pool. The canonical annotators are defaulted to in\n   *         {@link edu.stanford.nlp.pipeline.AnnotatorImplementations}.\n   */\n  protected AnnotatorImplementations getAnnotatorImplementations() {\n    return new AnnotatorImplementations();\n  }\n\n  //\n  // property-specific methods\n  //\n\n  private static String getRequiredProperty(Properties props, String name) {\n    String val = props.getProperty(name);\n    if (val == null) {\n      logger.error(\"Missing property \\\"\" + name + \"\\\"!\");\n      printRequiredProperties(System.err);\n      throw new RuntimeException(\"Missing property: \\\"\" + name + '\\\"');\n    }\n    return val;\n  }\n\n  /**\n   * Finds the properties file in the classpath and loads the properties from there.\n   *\n   * @return The found properties object (must be not-null)\n   * @throws RuntimeException If no properties file can be found on the classpath\n   */\n  private static Properties loadPropertiesFromClasspath() {\n    List<String> validNames = Arrays.asList(\"StanfordCoreNLP\", \"edu.stanford.nlp.pipeline.StanfordCoreNLP\");\n    for (String name : validNames) {\n      Properties props = loadProperties(name);\n      if (props != null) return props;\n    }\n    throw new RuntimeException(\"ERROR: Could not find properties file in the classpath!\");\n  }","sourceCodeStart":382,"sourceCodeEnd":418,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/pipeline/StanfordCoreNLP.java#L382-L418","documentation":"StanfordCoreNLP requires certain mandatory properties (e.g. annotators list) to build its pipeline. getRequiredProperty logs the missing key, prints the required-properties help, and throws a RuntimeException when props.getProperty(name) returns null. It is a fail-fast guard for missing pipeline configuration.","triggerScenarios":"Calling new StanfordCoreNLP(props) (or getRequiredProperty indirectly via annoNames) where the Properties object lacks the 'annotators' key or another required key.","commonSituations":"Constructing a Properties object programmatically and forgetting to set 'annotators'; loading an empty or wrong properties file; renaming a key after a CoreNLP version upgrade.","solutions":["Set the required property, typically props.setProperty(\"annotators\", \"tokenize,ssplit,pos,lemma,ner,parse,coref\").","Verify the Properties object actually loaded content (check loadProperties return / file path).","Read the printed 'required properties' help output which lists exactly what is missing.","Use StanfordCoreNLP.getProperties()/defaults or copy a known-good StanfordCoreNLP.properties from the classpath."],"exampleFix":"// before\nProperties props = new Properties();\nStanfordCoreNLP pipeline = new StanfordCoreNLP(props);\n// after\nProperties props = new Properties();\nprops.setProperty(\"annotators\", \"tokenize,ssplit,pos,lemma,ner\");\nStanfordCoreNLP pipeline = new StanfordCoreNLP(props);","handlingStrategy":"validation","validationCode":"if (props.getProperty(\"annotators\") == null) {\n  throw new IllegalArgumentException(\"props must define 'annotators' before creating StanfordCoreNLP\");\n}","typeGuard":null,"tryCatchPattern":"try { pipeline = new StanfordCoreNLP(props); } catch (RuntimeException e) { if (e.getMessage().startsWith(\"Missing property\")) { log.error(\"CoreNLP config incomplete: {}\", e.getMessage()); } throw e; }","preventionTips":["Always set 'annotators' as the first property in any CoreNLP config.","Start from a shipped StanfordCoreNLP.properties template and edit it.","Assert required keys exist in a startup self-check before building pipelines."],"tags":["java","configuration","missing-property","nlp-pipeline"],"backgroundTag":"missing-required-config-field","analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}