stanfordnlp/CoreNLP · error · RuntimeException
Line format error at line
Error message
Line format error at line ${lineNo}: ${line} What it means
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.
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
Example fix
// before (data.tsv) label value1 value2 // after (real tab characters) label value1 value2
Defensive patterns
Strategy: validation
Validate before calling
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"); } } Type guard
null
Try / catch
try { readDataset(path); } catch (RuntimeException e) { log.error("Data file format problem: " + e.getMessage()); } Prevention
- 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
When it happens
Trigger: 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).
Common situations: Data files saved with spaces instead of tabs; copy-pasted rows losing tabs; trailing malformed lines; editors converting tabs to spaces on save.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- Error: Line has too few tab-separated columns
- Dataset could not be loaded
- Not enough columns for format
- Unrecognized format specification in
- addFeature was called with a features object that is…
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/591ba111352e5af6.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/classify/ColumnDataClassifier.java:455
int minColumns = Integer.MAX_VALUE;
int maxColumns = 0;
for (String line : ObjectBank.getLineIterator(new File(filename), globalFlags.encoding)) {
lineNo++;
if (globalFlags.inputFormat == InputFormat.HEADER) {
if (lineNo == 1) {
if (storedHeader == null) {
storedHeader = line; // store it because need elements of it to print header in output
}
continue;
}
} else if (globalFlags.inputFormat == InputFormat.COMMENTS) {
if (line.matches("\\s#.*")) {
continue;
}
}
String[] strings = splitLineToFields(line);
if (strings.length < 2) {
throw new RuntimeException("Line format error at line " + lineNo + ": " + line);
}
if (strings.length < minColumns) {
minColumns = strings.length;
}
if (strings.length > maxColumns) {
maxColumns = strings.length;
}
if (inTestPhase) {
lineInfos.add(strings);
}
if (strings.length < flags.length) {
throw new RuntimeException("Error: Line has too few tab-separated columns (" + maxColumns +
") for " + flags.length + " columns required by specified properties: " + line);
}
dataset.add(makeDatumFromStrings(strings));
}
if (lineNo > 0 && minColumns != maxColumns) {
logger.info("WARNING: Number of tab-separated columns in " +View on GitHub (pinned to 1b7edd19c4)