{"record":{"id":"9557b26b9e63e7a6","repo":"stanfordnlp/CoreNLP","slug":"dataset-could-not-be-loaded","errorCode":null,"errorMessage":"Dataset could not be loaded","messagePattern":"Dataset could not be loaded","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/classify/ColumnDataClassifier.java","lineNumber":477,"sourceCode":"          }\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) {\n    if (globalFlags.csvInput) {\n      String[] strings = StringUtils.splitOnCharWithQuoting(line, ',', '\"', '\"');\n      for (int i = 0; i < strings.length; ++i) {\n        if (strings[i].startsWith(\"\\\"\") && strings[i].endsWith(\"\\\"\"))\n          strings[i] = strings[i].substring(1,strings[i].length()-1);\n      }\n      return strings;\n    }\n    else {\n      return tab.split(line);","sourceCodeStart":459,"sourceCodeEnd":495,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/classify/ColumnDataClassifier.java#L459-L495","documentation":"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().","triggerScenarios":"Any exception while reading the dataset file in readDataset: unreadable file path, IOException from the reader, or parsing failures inside makeDatumFromStrings, all rethrown uniformly.","commonSituations":"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.","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"],"exampleFix":"// before\nPair<Dataset<String,String>, List<String[]>> p = cdc.readDataset(filename);\n// after\ntry { var p = cdc.readDataset(filename); }\ncatch (RuntimeException e) { e.getCause().printStackTrace(); throw e; }","handlingStrategy":"try-catch","validationCode":"if (!Files.isReadable(Paths.get(filename))) throw new IllegalStateException(\"Cannot read dataset file: \" + filename);","typeGuard":"null","tryCatchPattern":"try { readDataset(f); } catch (RuntimeException e) { Throwable cause = e.getCause(); if (cause != null) cause.printStackTrace(); }","preventionTips":["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"],"tags":["java","column-data-classifier","wrapped-exception"],"backgroundTag":"file-read-failed","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"}