{"record":{"id":"12a5153ffd9379af","repo":"stanfordnlp/CoreNLP","slug":"cannot-find-gold-mention-with-id","errorCode":null,"errorMessage":"Cannot find gold mention with ID=","messagePattern":"Cannot find gold mention with ID=","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/coref/data/Document.java","lineNumber":290,"sourceCode":"        IntTuple pos = new IntTuple(2);\n        pos.set(0, i);\n        pos.set(1, j);\n        positions.put(id, pos);\n        antecedents.put(id, new ArrayList<>());\n      }\n    }\n\n//    SieveCoreferenceSystem.debugPrintMentions(System.err, \"\", goldOrderedMentionsBySentence);\n    for (List<Mention> mentions : goldMentions) {\n      for (Mention m : mentions) {\n        int id = m.mentionID;\n        IntTuple src = positions.get(id);\n\n        assert (src != null);\n        if (m.originalRef >= 0) {\n          IntTuple dst = positions.get(m.originalRef);\n          if (dst == null) {\n            throw new RuntimeException(\"Cannot find gold mention with ID=\" + m.originalRef);\n          }\n\n          // to deal with cataphoric annotation\n          while (dst.get(0) > src.get(0) || (dst.get(0) == src.get(0) && dst.get(1) > src.get(1))) {\n            Mention dstMention = goldMentions.get(dst.get(0)).get(dst.get(1));\n            m.originalRef = dstMention.originalRef;\n            dstMention.originalRef = id;\n\n            if (m.originalRef < 0) break;\n            dst = positions.get(m.originalRef);\n          }\n          if (m.originalRef < 0) continue;\n\n          // A B C: if A<-B, A<-C => make a link B<-C\n          for (int k = dst.get(0); k <= src.get(0); k++) {\n            for (int l = 0; l < goldMentions.get(k).size(); l++) {\n              if (k == dst.get(0) && l < dst.get(1)) continue;\n              if (k == src.get(0) && l > src.get(1)) break;","sourceCodeStart":272,"sourceCodeEnd":308,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/coref/data/Document.java#L272-L308","documentation":"Document.extractGoldLinks throws when a gold Mention's originalRef points to a mention ID absent from the document's positions map — i.e., the gold coreference chain references a mention that was never extracted. This is a data consistency failure in gold annotations.","triggerScenarios":"extractGoldLinks (via getGoldLinks) processing gold CoNLL annotations where m.originalRef >= 0 but positions.get(m.originalRef) returns null — a dangling reference in the gold data or mention filtering removed the referenced mention.","commonSituations":"Corrupted or hand-edited gold CoNLL files; preprocessed corpora where mentions were filtered but reference links were not updated; version mismatch between mention extraction and gold data format.","solutions":["Regenerate or re-download the gold corpus files and verify integrity","Check that mention extraction settings match the gold data format (no filtering that drops referenced mentions)","Pre-validate gold data: every non-negative originalRef must map to an existing mention","Run on the official supported CoNLL-2012 gold files rather than converted/modified copies"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"for (List<Mention> ms : doc.goldMentions)\n  for (Mention m : ms)\n    if (m.originalRef >= 0 && !doc.positions.containsKey(m.originalRef))\n      throw new IllegalStateException(\"Dangling gold ref: \" + m.originalRef);","typeGuard":null,"tryCatchPattern":"try {\n  doc.getGoldLinks();\n} catch (RuntimeException e) {\n  if (e.getMessage() != null && e.getMessage().startsWith(\"Cannot find gold mention with ID=\")) {\n    logger.severe(\"Gold data corrupt; regenerate gold files: \" + e.getMessage());\n  } else throw e;\n}","preventionTips":["Use official, unmodified CoNLL-2012 gold data and verify checksums","Avoid hand-editing gold files; regenerate through the supported converters","Keep mention extraction settings consistent with the gold data version","Pre-validate gold chains in a data-loading script"],"tags":["coref","gold-data","corrupt-data","assertion"],"backgroundTag":"entity-not-found","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"}