stanfordnlp/CoreNLP · error · RuntimeException
Error initializing coref system
Error message
Error initializing coref system
What it means
The CorefSystem constructor wraps all initialization (dictionaries, document maker, coref algorithm) in a try/catch and rethrows any failure as RuntimeException("Error initializing coref system", e). It indicates a bad configuration or missing model/dictionary resources; the true cause is in the chained exception.
Solutions
- Read the chained cause (e.getCause()) to find the actual failure and fix that root problem
- Validate all coref properties (algorithm name, model paths, language) against the version's CorefProperties defaults
- Ensure required coref models are downloaded and on the classpath (models jar matching your CoreNLP version)
- Try a minimal default Properties() with just language=english to isolate which setting breaks init
Example fix
// before
CorefSystem cs = new CorefSystem(badProps); // RuntimeException, cause hidden
// after
try { CorefSystem cs = new CorefSystem(props); }
catch (RuntimeException e) { e.getCause().printStackTrace(); } // inspect real cause Defensive patterns
Strategy: try-catch
Validate before calling
Properties p = new Properties();
p.setProperty("annotators", "coref");
p.setProperty("coref.algorithm", "statistical");
// verify required model resources exist before constructing
if (getClass().getResource("/edu/stanford/nlp/models/coref/") == null) {
throw new IllegalStateException("Coref models missing from classpath");
} Try / catch
try {
CorefSystem cs = new CorefSystem(props);
} catch (RuntimeException e) {
Throwable cause = e.getCause();
logger.log(Level.SEVERE, "Coref init failed: " + (cause == null ? e : cause), cause);
throw new IllegalStateException("Fix coref config/models; see cause", e);
} Prevention
- Always inspect getCause() — the wrapped exception names the real problem
- Keep the CoreNLP models jar version-matched to the CoreNLP library
- Validate coref properties keys/values against CorefProperties before construction
- Test coref init with default properties in CI to catch model/classpath regressions
When it happens
Trigger: Constructing new CorefSystem(Properties) where any of Dictionaries(props), DocumentMaker(props, dictionaries), or CorefAlgorithm.fromProps(props, dictionaries) throws — e.g. invalid property keys, missing model files, unreadable gender/dictionary data.
Common situations: Missing or mistyped coref.properties entries (ne demFile, singleton predictor model, algorithm name); coref models not on the classpath; running algorithm='neural' without the required model downloads; corrupted or incompatible model versions.
Related errors
- edu.stanford.nlp.coref.CorefScorer.ScorerMissingException
- Error making document
- Cannot enable POSSequence features without POS sequence…
- java.net.MalformedURLException
- Unknown LogPriorType:
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/66d5afc5cea340a8.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/coref/CorefSystem.java:44
/**
* Class for running coreference algorithms
* @author Kevin Clark
*/
public class CorefSystem {
private final DocumentMaker docMaker;
private final CorefAlgorithm corefAlgorithm;
private final boolean removeSingletonClusters;
private final boolean verbose;
public CorefSystem(Properties props) {
try {
Dictionaries dictionaries = new Dictionaries(props);
docMaker = new DocumentMaker(props, dictionaries);
corefAlgorithm = CorefAlgorithm.fromProps(props, dictionaries);
removeSingletonClusters = CorefProperties.removeSingletonClusters(props);
verbose = CorefProperties.verbose(props);
} catch (Exception e) {
throw new RuntimeException("Error initializing coref system", e);
}
}
public CorefSystem(DocumentMaker docMaker, CorefAlgorithm corefAlgorithm,
boolean removeSingletonClusters, boolean verbose) {
this.docMaker = docMaker;
this.corefAlgorithm = corefAlgorithm;
this.removeSingletonClusters = removeSingletonClusters;
this.verbose = verbose;
}
public void annotate(Annotation ann) {
Document document;
try {
document = docMaker.makeDocument(ann);
} catch (Exception e) {
throw new RuntimeException("Error making document", e);
}View on GitHub (pinned to 1b7edd19c4)