{"record":{"id":"dc01a2103adb664c","repo":"stanfordnlp/CoreNLP","slug":"file-filename-line-linesread-too-short","errorCode":null,"errorMessage":"File ${filename} line #${linesRead} too short","messagePattern":"File (.+?) line #(.+?) too short","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/tagger/io/TSVTaggedFileReader.java","lineNumber":88,"sourceCode":"        line = reader.readLine();\n        ++linesRead;\n      } catch (IOException e) {\n        throw new RuntimeException(e);\n      }\n      if (line == null) {\n        next = null;\n        return;\n      }\n    }\n    // we hit something with text, so now we read one line at a time\n    // until we hit the next blank line.  the next blank line (or EOF)\n    // ends the sentence.\n    next = new ArrayList<>();\n    while (line != null && ! line.trim().isEmpty()) {\n      if (!(usesComments && line.startsWith(\"#\"))) {\n        String[] pieces = line.split(\"\\t\");\n        if (pieces.length <= wordColumn || pieces.length <= tagColumn) {\n          throw new IllegalArgumentException(\"File \" + filename + \" line #\" +\n                                             linesRead + \" too short\");\n        }\n        if (!(skipMWT && pieces[0].matches(\"[0-9]+-[0-9]+\"))) {\n          String word = pieces[wordColumn];\n          String tag = pieces[tagColumn];\n          next.add(new TaggedWord(word, tag));\n        }\n      }\n      try {\n        line = reader.readLine();\n        ++linesRead;\n      } catch (IOException e) {\n        throw new RuntimeException(e);\n      }\n    }\n  }\n\n  @Override","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/tagger/io/TSVTaggedFileReader.java#L70-L106","documentation":"TSVTaggedFileReader splits each non-empty line of a TSV training/test file on tabs and needs entries at both wordColumn and tagColumn indices. If a line has fewer tab-separated fields than required, primeNext() throws IllegalArgumentException identifying the file and line number.","triggerScenarios":"Reading a TSV file where a line (or the last line before EOF, or a sentence-final line) contains fewer tab-separated columns than max(wordColumn, tagColumn)+1, given the configured columns.","commonSituations":"Files exported with spaces instead of tabs, rows with missing trailing tag columns, editor tools converting tabs, blank-ish lines with stray content, or mismatched column configuration (e.g., columns set to 1,2 but the file has 2 fields).","solutions":["Open the file at the reported line number and fix or remove the short line.","Confirm wordColumn/tagColumn options match the actual number of columns in your file.","Regenerate or re-export the file ensuring every row has all required tab-separated fields (use a TSV-aware tool, not a spreadsheet that may alter tabs)."],"exampleFix":"// before\n// config: -wordColumn 1 -tagColumn 2, but file rows have only 2 columns\nthe\tDT\n// after (add missing column or fix config)\n1\tthe\tDT","handlingStrategy":"validation","validationCode":"// Java: pre-check file before tagging\nList<String> bad = new ArrayList<>();\nint ln = 0;\nfor (String line : Files.readAllLines(path)) {\n  ln++;\n  if (!line.trim().isEmpty() && line.split(\"\\t\").length <= Math.max(wordColumn, tagColumn))\n    bad.add(\"line \" + ln);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Lint TSV files for the required column count before training/testing.","Keep files tab-delimited (avoid spreadsheet round-trips that alter tabs).","Match wordColumn/tagColumn configuration to the actual file layout.","Trim trailing blank/garbage lines from exported files."],"tags":["nlp","pos-tagger","file-parsing","tsv"],"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"}