{"record":{"id":"591ba111352e5af6","repo":"stanfordnlp/CoreNLP","slug":"line-format-error-at-line-lineno-line","errorCode":null,"errorMessage":"Line format error at line ${lineNo}: ${line}","messagePattern":"Line format error at line (.+?): (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/classify/ColumnDataClassifier.java","lineNumber":455,"sourceCode":"        int minColumns = Integer.MAX_VALUE;\n        int maxColumns = 0;\n        for (String line : ObjectBank.getLineIterator(new File(filename), globalFlags.encoding)) {\n          lineNo++;\n          if (globalFlags.inputFormat == InputFormat.HEADER) {\n            if (lineNo == 1) {\n              if (storedHeader == null) {\n                storedHeader = line; // store it because need elements of it to print header in output\n              }\n              continue;\n            }\n          } else if (globalFlags.inputFormat == InputFormat.COMMENTS) {\n            if (line.matches(\"\\\\s#.*\")) {\n              continue;\n            }\n          }\n          String[] strings = splitLineToFields(line);\n          if (strings.length < 2) {\n            throw new RuntimeException(\"Line format error at line \" + lineNo + \": \" + line);\n          }\n          if (strings.length < minColumns) {\n            minColumns = strings.length;\n          }\n          if (strings.length > maxColumns) {\n            maxColumns = strings.length;\n          }\n          if (inTestPhase) {\n            lineInfos.add(strings);\n          }\n          if (strings.length < flags.length) {\n            throw new RuntimeException(\"Error: Line has too few tab-separated columns (\" + maxColumns +\n                    \") for \" + flags.length + \" columns required by specified properties: \" + line);\n          }\n          dataset.add(makeDatumFromStrings(strings));\n        }\n        if (lineNo > 0 && minColumns != maxColumns) {\n          logger.info(\"WARNING: Number of tab-separated columns in \" +","sourceCodeStart":437,"sourceCodeEnd":473,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/classify/ColumnDataClassifier.java#L437-L473","documentation":"ColumnDataClassifier.readDataset splits each input line into tab-separated fields; a line yielding fewer than 2 fields cannot contain even a class label plus one feature column, so it throws a RuntimeException reporting the line number and content. This is a data-file format validation error, not a code bug.","triggerScenarios":"A training/test data line containing no tab separator (single column or blank-but-not-skipped line), encountered during readDataset (called by dataInfo or readTestExamples).","commonSituations":"Data files saved with spaces instead of tabs; copy-pasted rows losing tabs; trailing malformed lines; editors converting tabs to spaces on save.","solutions":["Open the reported line and ensure it has at least one tab separating the gold label from feature columns","Check the file for space-separated values and re-export with real tab delimiters","Remove or fix blank/stray lines near the reported lineNo"],"exampleFix":"// before (data.tsv)\nlabel value1 value2\n// after (real tab characters)\nlabel\tvalue1\tvalue2","handlingStrategy":"validation","validationCode":"try (var lines = Files.readAllLines(Paths.get(file))) { int i=0; for (String l : lines) { i++; if (!l.trim().isEmpty() && !l.matches(\"\\\\s#.*\") && l.split(\"\\t\").length < 2) throw new IllegalStateException(\"Line \" + i + \" has <2 tab-separated fields\"); } }","typeGuard":"null","tryCatchPattern":"try { readDataset(path); } catch (RuntimeException e) { log.error(\"Data file format problem: \" + e.getMessage()); }","preventionTips":["Save data files with real tabs, not spaces (check editor tab/space settings)","Skip/comment junk lines with # or blank lines","Lint the TSV (column count per line) before handing it to the classifier"],"tags":["java","column-data-classifier","data-format"],"backgroundTag":"invalid-argument-format","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"}