{"record":{"id":"a123f4b7626173b0","repo":"stanfordnlp/CoreNLP","slug":"error-line-has-too-few-tab-separated-columns-m","errorCode":null,"errorMessage":"Error: Line has too few tab-separated columns (${maxColumns}) for ${flags.length} columns required by specified properties: ${line}","messagePattern":"Error: Line has too few tab-separated columns \\((.+?)\\) for (.+?) columns required by specified properties: (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/classify/ColumnDataClassifier.java","lineNumber":467,"sourceCode":"            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 \" +\n                  filename + \" varies between \" + minColumns + \" and \" + maxColumns);\n        }\n      } catch (Exception e) {\n        throw new RuntimeException(\"Dataset could not be loaded\", e);\n      }\n    }\n    logger.info(\"Reading dataset from \" + filename + \" ... done [\" + tim.toSecondsString() + \"s, \" + dataset.size() + \" items].\");\n    return new Pair<>(dataset, lineInfos);\n  }\n\n  /** Split according to whether we are using tsv file (default) or csv files. */\n  private String[] splitLineToFields(String line) {","sourceCodeStart":449,"sourceCodeEnd":485,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/classify/ColumnDataClassifier.java#L449-L485","documentation":"After per-line checks pass, readDataset verifies each line has at least as many tab-separated columns as the number of feature properties (flags.length) configured. A line with fewer columns cannot supply values for all configured features, so it throws a RuntimeException reporting the observed max column count and the offending line. Note the count shown is maxColumns (the widest line seen), not the offending line's width.","triggerScenarios":"Running readDataset (via dataInfo or readTestExamples) when the properties file defines more feature columns (e.g. columns 0..N) than some data line provides tab-separated fields.","commonSituations":"Mismatch between the properties file's column definitions and the actual TSV; a short row in the middle of the file; switching to a test file with fewer columns without updating properties.","solutions":["Add the missing tab-separated columns to the offending line so it matches flags.length","Reduce the column mappings in your properties file to match the data's actual column count","Verify delimiters are real tabs (the splitter is tab-based)"],"exampleFix":"// before (3 columns, properties need 4)\nlabel\tf1\tf2\n// after\nlabel\tf1\tf2\tf3","handlingStrategy":"validation","validationCode":"int minCols = lines.stream().mapToInt(l -> l.split(\"\\t\", -1).length).min().orElse(0); if (minCols < flagsCount) throw new IllegalStateException(\"File has only \" + minCols + \" columns, need \" + flagsCount);","typeGuard":"null","tryCatchPattern":"try { readDataset(path); } catch (RuntimeException e) { log.error(\"Column count mismatch between properties and data: \" + e.getMessage(), e); }","preventionTips":["Keep the properties column mappings and the TSV schema in sync","Count columns (head -1 file | awk -F'\\t' '{print NF}') before running","Reduce configured columns when switching to smaller test files"],"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"}