stanfordnlp/CoreNLP · error · RuntimeException
Dataset could not be loaded
Error message
Dataset could not be loaded
What it means
readDataset wraps its entire file-reading loop in a try/catch and rethrows any Exception as a RuntimeException("Dataset could not be loaded", e) with the original as the cause. This generic wrapper can mask the real problem — an IO error, NumberFormatException during feature parsing, or the line-format errors above — so always inspect getCause().
Solutions
- Read the cause via e.getCause() / print the full stack trace to find the underlying failure
- Verify the dataset file path exists and is readable
- Check that all feature values in the file parse correctly for the configured column types
Example fix
// before
Pair<Dataset<String,String>, List<String[]>> p = cdc.readDataset(filename);
// after
try { var p = cdc.readDataset(filename); }
catch (RuntimeException e) { e.getCause().printStackTrace(); throw e; } Defensive patterns
Strategy: try-catch
Validate before calling
if (!Files.isReadable(Paths.get(filename))) throw new IllegalStateException("Cannot read dataset file: " + filename); Type guard
null
Try / catch
try { readDataset(f); } catch (RuntimeException e) { Throwable cause = e.getCause(); if (cause != null) cause.printStackTrace(); } Prevention
- Always inspect getCause(); the wrapper message is generic
- Verify file path, existence, and permissions before loading
- Fix root causes like line-format errors (see indexes 4/5) rather than the wrapper
When it happens
Trigger: Any exception while reading the dataset file in readDataset: unreadable file path, IOException from the reader, or parsing failures inside makeDatumFromStrings, all rethrown uniformly.
Common situations: Wrong filename/path passed to -testFile or training data options; unreadable file permissions; feature values that fail to parse into numbers; nested line-format errors from entries 4/5.
Understand the failure class
Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.
Related errors
- Line format error at line
- Error: Line has too few tab-separated columns
- 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/9557b26b9e63e7a6.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/classify/ColumnDataClassifier.java:477
}
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 " +
filename + " varies between " + minColumns + " and " + maxColumns);
}
} catch (Exception e) {
throw new RuntimeException("Dataset could not be loaded", e);
}
}
logger.info("Reading dataset from " + filename + " ... done [" + tim.toSecondsString() + "s, " + dataset.size() + " items].");
return new Pair<>(dataset, lineInfos);
}
/** Split according to whether we are using tsv file (default) or csv files. */
private String[] splitLineToFields(String line) {
if (globalFlags.csvInput) {
String[] strings = StringUtils.splitOnCharWithQuoting(line, ',', '"', '"');
for (int i = 0; i < strings.length; ++i) {
if (strings[i].startsWith("\"") && strings[i].endsWith("\""))
strings[i] = strings[i].substring(1,strings[i].length()-1);
}
return strings;
}
else {
return tab.split(line);View on GitHub (pinned to 1b7edd19c4)