stanfordnlp/CoreNLP · error · RuntimeException
Must load a classifier when creating a column data…
Error message
Must load a classifier when creating a column data classifier annotator
What it means
Stanford CoreNLP's columnData annotator wraps ColumnDataClassifier, which can only run if a trained classifier model is supplied. AnnotatorImplementations.columnData() requires a 'loadClassifier' property; if absent it throws this RuntimeException before creating the annotator.
Solutions
- Set 'classify.loadClassifier' (or 'loadClassifier') to the path of your trained classifier model in the Properties before creating the pipeline
- Verify the model file exists and is readable at that path
- If you meant generic classification, check you are using the right annotator name and its documented properties
Example fix
// before
props.setProperty("annotators", "classify");
// after
props.setProperty("annotators", "classify");
props.setProperty("classify.loadClassifier", "models/my-column-classifier.txt"); Defensive patterns
Strategy: validation
Validate before calling
Properties props = ...;
if (!props.containsKey("loadClassifier") && !props.containsKey("classify.loadClassifier")) {
throw new IllegalArgumentException("classify annotator requires classify.loadClassifier");
} Try / catch
try {
Annotator a = impl.columnData(props);
} catch (RuntimeException e) {
if (e.getMessage().contains("Must load a classifier")) {
// prompt user for classify.loadClassifier
} else throw e;
} Prevention
- Always set classify.loadClassifier when using the classify annotator
- Check model file existence with File.exists() before building the pipeline
- Reuse a validated properties template
When it happens
Trigger: Calling AnnotatorFactory/StanfordCoreNLP with annotator 'classify' (column data) while the Properties contain neither 'loadClassifier' nor 'classify.loadClassifier'.
Common situations: Users configure 'annotators=classify' but forget to point at a trained ColumnDataClassifier model file; copying a properties template that omits the model path; renaming the property key so it no longer matches.
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
- Unknown minimizer
- Unknown clique: " + clique
- No annotator named " + name
- Expected a property " + name + ".model
- Expected a property " + name + ".model
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/4a72634a2a259ebd.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/pipeline/AnnotatorImplementations.java:251
}
/**
* Annotate for sentiment in sentences
*/
public Annotator sentiment(Properties properties, String name) {
return new SentimentAnnotator(name, properties);
}
/**
* Annotate with the column data classifier.
*/
public Annotator columnData(Properties properties) {
if (properties.containsKey("classify.loadClassifier")) {
properties.setProperty("loadClassifier", properties.getProperty("classify.loadClassifier"));
}
if (!properties.containsKey("loadClassifier")) {
throw new RuntimeException("Must load a classifier when creating a column data classifier annotator");
}
return new ColumnDataClassifierAnnotator(properties);
}
/**
* Annotate dependency relations in sentences
*/
public Annotator dependencies(Properties properties) {
Properties relevantProperties = PropertiesUtils.extractPrefixedProperties(properties,
Annotator.STANFORD_DEPENDENCIES + '.');
if (!relevantProperties.containsKey("nthreads") &&
properties.containsKey("nthreads")) {
relevantProperties.setProperty("nthreads", properties.getProperty("nthreads"));
}
return new DependencyParseAnnotator(relevantProperties);
}
View on GitHub (pinned to 1b7edd19c4)