stanfordnlp/CoreNLP · critical · RuntimeException
Missing property
Error message
Missing property: "${name}" What it means
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.
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.
Example fix
// before
Properties props = new Properties();
StanfordCoreNLP pipeline = new StanfordCoreNLP(props);
// after
Properties props = new Properties();
props.setProperty("annotators", "tokenize,ssplit,pos,lemma,ner");
StanfordCoreNLP pipeline = new StanfordCoreNLP(props); Defensive patterns
Strategy: validation
Validate before calling
if (props.getProperty("annotators") == null) {
throw new IllegalArgumentException("props must define 'annotators' before creating StanfordCoreNLP");
} Try / catch
try { pipeline = new StanfordCoreNLP(props); } catch (RuntimeException e) { if (e.getMessage().startsWith("Missing property")) { log.error("CoreNLP config incomplete: {}", e.getMessage()); } throw e; } Prevention
- 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.
When it happens
Trigger: Calling new StanfordCoreNLP(props) (or getRequiredProperty indirectly via annoNames) where the Properties object lacks the 'annotators' key or another required key.
Common situations: 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.
Understand the failure class
Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.
Related errors
- Both parse.model and parse.executable properties must be…
- Can only create a model using this method if…
- Cannot create random word vectors for an unknown numHid
- Cannot determine annotation key for
- Cannot infer requirements for annotator
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/1c70783c2967df51.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/pipeline/StanfordCoreNLP.java:400
*
* @return A class which specifies the actual implementation of each of the annotators called
* when creating the annotator pool. The canonical annotators are defaulted to in
* {@link edu.stanford.nlp.pipeline.AnnotatorImplementations}.
*/
protected AnnotatorImplementations getAnnotatorImplementations() {
return new AnnotatorImplementations();
}
//
// property-specific methods
//
private static String getRequiredProperty(Properties props, String name) {
String val = props.getProperty(name);
if (val == null) {
logger.error("Missing property \"" + name + "\"!");
printRequiredProperties(System.err);
throw new RuntimeException("Missing property: \"" + name + '\"');
}
return val;
}
/**
* Finds the properties file in the classpath and loads the properties from there.
*
* @return The found properties object (must be not-null)
* @throws RuntimeException If no properties file can be found on the classpath
*/
private static Properties loadPropertiesFromClasspath() {
List<String> validNames = Arrays.asList("StanfordCoreNLP", "edu.stanford.nlp.pipeline.StanfordCoreNLP");
for (String name : validNames) {
Properties props = loadProperties(name);
if (props != null) return props;
}
throw new RuntimeException("ERROR: Could not find properties file in the classpath!");
}View on GitHub (pinned to 1b7edd19c4)