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
- Unwrap and inspect e.getCause() — the root stack trace identifies the failing sieve or component
- Verify model/dictionary paths in props match the hybrid coref distribution files
- Run with one sieve at a time (trim the sieves property) to isolate the failing stage
- 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
- Always log the full cause chain, not just the wrapper message
- Run preprocessing (tokenize/NER/parse) before coref
- Test sieve configurations on a small document first
- Pin CoreNLP model versions matching your library version
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
- Dataset could not be loaded
- DocumentIterator exhausted.
- Error creating data exporter
- Unsupported file format: " + filename
- DocumentIterator exhausted.
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)); // goldView on GitHub (pinned to 1b7edd19c4)