{"record":{"id":"226140121610a43d","repo":"stanfordnlp/CoreNLP","slug":"error-running-hybrid-coref-system","errorCode":null,"errorMessage":"Error running hybrid coref system","messagePattern":"Error running hybrid coref system","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/coref/hybrid/HybridCorefSystem.java","lineNumber":229,"sourceCode":"    while (wrapper.peek()) {\n      StringBuilder[] output = wrapper.poll();\n      writerGold.print(output[0]);\n      writerBeforeCoref.print(output[1]);\n      writerAfterCoref.print(output[2]);\n      if (output[3].length() > 0) {\n        log.info(output[3]);\n      }\n      if ((++docCnt) % 10 == 0) log.info(docCnt + \" document(s) processed\");\n    }\n    return docCnt;\n  }\n\n  @Override\n  public void runCoref(Document document) {\n    try {\n      coref(document);\n    } catch (Exception e) {\n      throw new RuntimeException(\"Error running hybrid coref system\", e);\n    }\n  }\n\n  /**\n   * main entry of coreference system.\n   *\n   * @param document Input document for coref format (Annotation and optional information)\n   * @param output For output of coref system (conll format and log. list size should be 4.)\n   * @return Map of coref chain ID and corresponding chain\n   * @throws Exception\n   */\n  public Map<Integer, CorefChain> coref(Document document, StringBuilder[] output) throws Exception {\n    if(HybridCorefProperties.printMDLog(props)) {\n      Redwood.log(HybridCorefPrinter.printMentionDetectionLog(document));\n    }\n\n    if(HybridCorefProperties.doScore(props)) {\n      output[0] = (new StringBuilder()).append(CorefPrinter.printConllOutput(document, true));  // gold","sourceCodeStart":211,"sourceCodeEnd":247,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/coref/hybrid/HybridCorefSystem.java#L211-L247","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\ntry {\n  system.runCoref(doc);\n} catch (RuntimeException e) {\n  log(\"coref failed\"); // hides cause\n}\n// after\ntry {\n  system.runCoref(doc);\n} catch (RuntimeException e) {\n  log(\"coref failed\", e.getCause()); // root cause is wrapped\n}","handlingStrategy":"try-catch","validationCode":"// Pre-run sanity checks before invoking the pipeline\nObjects.requireNonNull(document, \"document\");\nif (document.getGoldMentions() == null || document.getGoldMentions().isEmpty()) throw new IllegalStateException(\"Document has no mentions — run preprocessing first\");","typeGuard":null,"tryCatchPattern":"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; }","preventionTips":["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"],"tags":["java","coreference","wrapped-exception","pipeline"],"backgroundTag":"internal-invariant-violation","analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}