stanfordnlp/CoreNLP · error · RuntimeException

No gold info

Error message

No gold info

What it means

DocumentPreprocessor.extractGoldClusters throws RuntimeException("No gold info") when a gold Mention has goldCorefClusterID == -1, meaning the mention was never assigned to a gold coreference cluster. The document's gold annotations are incomplete.

Solutions

  1. Ensure gold annotations are fully loaded and goldCorefClusterID is assigned for every mention before preprocessing
  2. If you don't need gold clusters, use a code path that doesn't call extractGoldClusters (plain annotate, not CoNLL scoring runs)
  3. Validate gold files: every mention must belong to a coref chain
  4. Regenerate gold data with the matching CoreNLP version's preprocessing tools
Defensive patterns

Strategy: validation

Validate before calling

for (List<Mention> ms : doc.goldMentions)
  for (Mention m : ms)
    if (m.goldCorefClusterID == -1)
      throw new IllegalStateException("Mention without gold cluster: " + m);

Try / catch

try {
  preprocessor.preprocess(props, doc);
} catch (RuntimeException e) {
  if ("No gold info".equals(e.getMessage())) {
    logger.severe("Gold cluster IDs missing; gold annotation required for this run");
  } else throw e;
}

Prevention

When it happens

Trigger: extractGoldClusters (via preprocess) iterating doc.goldMentions where some Mention lacks a valid goldCorefClusterID (-1) — gold cluster assignment was skipped or lost before preprocessing.

Common situations: Running the coref system on documents without gold mention/cluster annotation while expecting gold clusters; custom Mention construction not setting goldCorefClusterID; loading gold data with an incompatible reader version.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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

Appendix: source

Thrown at src/edu/stanford/nlp/coref/data/DocumentPreprocessor.java:100

        if(g.hasTwin) foundGoldCount++;
      }
      Redwood.log("debug-md", "# of found gold mentions: "+ foundGoldCount +
          " / # of gold mentions: "+ doc.goldMentionsByID.size());

    }

    // assign mention numbers
    assignMentionNumbers(doc);
  }

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

  private static void assignMentionNumbers(Document document) {
    List<Mention> mentionsList = CorefUtils.getSortedMentions(document);
    for (int i = 0; i < mentionsList.size(); i++) {
      mentionsList.get(i).mentionNum = i;
    }
  }

View on GitHub (pinned to 1b7edd19c4)