stanfordnlp/CoreNLP · error · RuntimeException

No gold info

Error message

No gold info

What it means

extractGoldCorefClusters builds the gold coreference clusters from goldOrderedMentionsBySentence and throws RuntimeException("No gold info") when any mention has goldCorefClusterID == -1, i.e. no gold annotation exists. dcoref requires a gold-annotated corpus (or gold preprocessing) to score; it cannot build clusters without gold IDs.

Solutions

  1. Provide a gold key (MUC/CoNLL) file so gold coref cluster IDs get assigned
  2. Run with a mention extractor that reads gold annotations (MUCMentionExtractor/CoNLLMentionExtractor) with gold input configured
  3. If only running on raw text, use the non-scoring coref pipeline path (no gold extraction/scored output)
  4. Check that preprocessed gold mentions set goldCorefClusterID correctly

Example fix

// before
props.setProperty("coref.conll.outputDir", "out"); // raw text, no gold key, scoring pipeline
// after
props.setProperty("dcoref.score", "false"); // skip gold-based scoring for raw text
// or supply gold input:
props.setProperty("coref.doc.conll", "test/test.conll");
Defensive patterns

Strategy: validation

Validate before calling

// before running a scoring coref pipeline, ensure gold annotations are present
for (List<Mention> mentions : document.getGoldOrderedMentionsBySentence()) {
    for (Mention m : mentions) {
        if (m.goldCorefClusterID == -1) {
            throw new IllegalStateException("Document lacks gold coref annotations");
        }
    }
}

Try / catch

try {
    doc.extractGoldCorefClusters();
} catch (RuntimeException e) {
    if ("No gold info".equals(e.getMessage())) {
        log.warn("No gold annotations; switching to non-scoring pipeline");
        return; // run without scoring
    }
    throw e;
}

Prevention

When it happens

Trigger: Running the coref system in a mode that calls extractGoldCorefClusters (runCorefSystem/runAndScoreCoref/generateFeatureVectors) on a document whose mentions were parsed without gold coref annotations (e.g. plain-text input, no MUC/CoNLL gold key, mentions parsed by SentenceMatchedMentionExtractor without gold data).

Common situations: Running on unannotated raw text while using an evaluation/scored pipeline, missing gold key file in properties, or using a mention extractor that does not load gold cluster IDs.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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

Appendix: source

Thrown at src/edu/stanford/nlp/dcoref/Document.java:497

    }
    if(!hasOriginalID){
      int id = 0;
      for(List<Mention> l : orderedMentionsBySentence){
        for(Mention m : l){
          m.mentionID = id++;
        }
      }
    }
  }

  /** Extract gold coref cluster information. */
  public void extractGoldCorefClusters(){
    goldCorefClusters = Generics.newHashMap();
    for (List<Mention> mentions : goldOrderedMentionsBySentence) {
      for (Mention m : mentions) {
        int id = m.goldCorefClusterID;
        if (id == -1) {
          throw new RuntimeException("No gold info");
        }
        CorefCluster c = goldCorefClusters.get(id);
        if (c == null) {
          c = new CorefCluster(id);
          goldCorefClusters.put(id, c);
        }
        c.corefMentions.add(m);
      }
    }
  }

  protected List<Pair<IntTuple, IntTuple>> getGoldLinks() {
    if(goldLinks==null) this.extractGoldLinks();
    return goldLinks;
  }

  /** Extract gold coref link information */
  protected void extractGoldLinks() {

View on GitHub (pinned to 1b7edd19c4)