stanfordnlp/CoreNLP · error · RuntimeException

Error running hybrid coref system

Error message

Error running hybrid coref system

What it means

HybridCorefSystem.runCoref(Document) wraps the per-document coref() call in a try/catch and rethrows any Exception as RuntimeException("Error running hybrid coref system", e). It is a blanket wrapper for the whole sieve-based coreference pipeline, so the actual cause (NPE, sieve failure, model load error) is in the wrapped exception.

Solutions

  1. Unwrap and inspect e.getCause() — the root stack trace identifies the failing sieve or component
  2. Verify model/dictionary paths in props match the hybrid coref distribution files
  3. Run with one sieve at a time (trim the sieves property) to isolate the failing stage
  4. Check that input documents passed annotation preprocessing (tokenization, NER, parsing) as required before coref

Example fix

// before
try {
  system.runCoref(doc);
} catch (RuntimeException e) {
  log("coref failed"); // hides cause
}
// after
try {
  system.runCoref(doc);
} catch (RuntimeException e) {
  log("coref failed", e.getCause()); // root cause is wrapped
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-run sanity checks before invoking the pipeline
Objects.requireNonNull(document, "document");
if (document.getGoldMentions() == null || document.getGoldMentions().isEmpty()) throw new IllegalStateException("Document has no mentions — run preprocessing first");

Try / catch

try { system.runCoref(doc); } catch (RuntimeException e) { Throwable root = e; while (root.getCause() != null) root = root.getCause(); log.error("Coref failed, root cause: " + root, e); throw e; }

Prevention

When it happens

Trigger: Any failure inside coref(document): a sieve throwing (bad sieve config, missing dictionaries/models), null mentions from preprocessing, or feature extraction errors during hybrid coref processing of a document.

Common situations: Running the hybrid pipeline with models/dictionaries on a wrong path; feeding documents whose preprocessing produced empty mentions; a custom Sieve subclass throwing; incompatible properties for the chosen language.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10). Data as JSON: /api/errors/226140121610a43d. Report an issue: GitHub.

Appendix: source

Thrown at src/edu/stanford/nlp/coref/hybrid/HybridCorefSystem.java:229

    while (wrapper.peek()) {
      StringBuilder[] output = wrapper.poll();
      writerGold.print(output[0]);
      writerBeforeCoref.print(output[1]);
      writerAfterCoref.print(output[2]);
      if (output[3].length() > 0) {
        log.info(output[3]);
      }
      if ((++docCnt) % 10 == 0) log.info(docCnt + " document(s) processed");
    }
    return docCnt;
  }

  @Override
  public void runCoref(Document document) {
    try {
      coref(document);
    } catch (Exception e) {
      throw new RuntimeException("Error running hybrid coref system", e);
    }
  }

  /**
   * main entry of coreference system.
   *
   * @param document Input document for coref format (Annotation and optional information)
   * @param output For output of coref system (conll format and log. list size should be 4.)
   * @return Map of coref chain ID and corresponding chain
   * @throws Exception
   */
  public Map<Integer, CorefChain> coref(Document document, StringBuilder[] output) throws Exception {
    if(HybridCorefProperties.printMDLog(props)) {
      Redwood.log(HybridCorefPrinter.printMentionDetectionLog(document));
    }

    if(HybridCorefProperties.doScore(props)) {
      output[0] = (new StringBuilder()).append(CorefPrinter.printConllOutput(document, true));  // gold

View on GitHub (pinned to 1b7edd19c4)