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

  1. Read the chained cause (e.getCause()) to find the actual failure and fix that root problem
  2. Validate all coref properties (algorithm name, model paths, language) against the version's CorefProperties defaults
  3. Ensure required coref models are downloaded and on the classpath (models jar matching your CoreNLP version)
  4. 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

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


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)