{"record":{"id":"254208d60d8140bf","repo":"stanfordnlp/CoreNLP","slug":"error-extracting-labelled-spans-for-column-fieldi","errorCode":null,"errorMessage":"Error extracting labelled spans for column {fieldIndex}: {concatField(sentWords, fieldIndex)}","messagePattern":"Error extracting labelled spans for column (.+?): (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/dcoref/CoNLL2011DocumentReader.java","lineNumber":408,"sourceCode":"              }\n              t.setSecond(wordPos);\n              spans.add(t);\n            }\n            if (isDelimiter) {\n              lastDelimiterIndex = j;\n            }\n          }\n          if (openParenIndex >= 0) {\n            String s = val.substring(openParenIndex+1, val.length());\n            if (removeStar) {\n              s = starPattern.matcher(s).replaceAll(\"\");\n            }\n            openSpans.push(new Triple<>(wordPos, -1, s));\n          }\n        }\n      }\n      if (openSpans.size() != 0) {\n        throw new RuntimeException(\"Error extracting labelled spans for column \" + fieldIndex + \": \"\n                + concatField(sentWords, fieldIndex));\n      }\n      return spans;\n    }\n\n    private CoreMap wordsToSentence(List<String[]> sentWords)\n    {\n      String sentText = concatField(sentWords, FIELD_WORD);\n      Annotation sentence = new Annotation(sentText);\n      Tree tree = wordsToParse(sentWords);\n      sentence.set(TreeCoreAnnotations.TreeAnnotation.class, tree);\n      List<Tree> leaves = tree.getLeaves();\n      // Check leaves == number of words\n      assert(leaves.size() == sentWords.size());\n      List<CoreLabel> tokens = new ArrayList<>(leaves.size());\n      sentence.set(CoreAnnotations.TokensAnnotation.class, tokens);\n      for (int i = 0; i < sentWords.size(); i++) {\n        String[] fields = sentWords.get(i);","sourceCodeStart":390,"sourceCodeEnd":426,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/dcoref/CoNLL2011DocumentReader.java#L390-L426","documentation":"CoNLL2011DocumentReader.getLabelledSpans builds coreference spans from per-column token labels using an openSpans stack. If any span was opened (pushed) but never closed by the end of the sentence's words, the stack is non-empty and the reader throws this RuntimeException, because the CoNLL file has an unterminated span for that column.","triggerScenarios":"Parsing a CoNLL-2011/2012 corpus file where a begin-label (e.g. an opening coreference bracket or other labelled column value) appears for a token but the matching end/continuation label is never seen before the sentence ends — i.e. unbalanced bracket annotation in the corpus data.","commonSituations":"Truncated or hand-edited CoNLL corpus files; annotation-converted files (e.g. from OntoNotes conversions) with dropped closing rows; custom-preprocessed columns where the closing marker was lost; wrong column index (fieldIndex) passed so a non-coref column is interpreted as containing span labels.","solutions":["Inspect the CoNLL file named in the message at the reported column and fix/complete the unterminated span annotation (add the missing closing row).","Validate the corpus with the official CoNLL scorer/scripts (which report unbalanced brackets) before running dcoref.","Re-download or regenerate the corpus files — truncation during download/extraction is common.","Verify the fieldIndex/column constants used when reading the file match the actual file layout.","If preprocessing yourself, write a round-trip check that every opened span is closed per sentence before consuming the file."],"exampleFix":"// before (broken corpus row, span opened but never closed)\n// word ... (0  <- coref column opens span on this token, sentence ends\n\n// after\n// word ... (0)\n// ... or complete the span across rows:\n// word1 ... (0\n// word2 ... 0)  <- span properly closed","handlingStrategy":"validation","validationCode":"// Validate CoNLL file balance before running dcoref\nint open = 0;\nfor (String[] row : sentences) {\n  String col = row[fieldIndex];\n  if (col.startsWith(\"(\")) open += col.contains(\")\") ? 0 : 1;\n  else if (col.contains(\")\")) open--; // check per-row semantics\n}\nif (open != 0) throw new IllegalStateException(\"Unbalanced spans in column \" + fieldIndex);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run the official CoNLL scorer over your corpus to detect unbalanced brackets before parsing.","Never hand-edit CoNLL files without re-validating bracket balance.","Checksum corpus downloads and verify file sizes after extraction.","Pin column index constants to the documented CoNLL-2011 layout and assert field counts per line."],"tags":["java","corpus-parsing","data-integrity","corenlp"],"backgroundTag":"schema-validation-failed","analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}