stanfordnlp/CoreNLP · error · RuntimeIOException
RuntimeIOException wrapping IOException from write
Error message
RuntimeIOException wrapping IOException from write
What it means
TreeRecorder.evaluate writes each parse tree line to the wrapped BufferedWriter; if the underlying write fails with a checked IOException it is rethrown as an unchecked RuntimeIOException. This keeps the evaluator API free of checked exceptions while signaling an I/O failure during recording.
Solutions
- Check free disk space on the output volume before starting a long recording run
- Ensure nothing deletes or truncates the output file while TreeRecorder is open
- Catch RuntimeIOException around evaluate() and persist partial state or abort cleanly
- Write to a local, reliable filesystem rather than a flaky network mount
Example fix
// before
recorder.evaluate(query, goldTree, pw);
// after
try {
recorder.evaluate(query, goldTree, pw);
} catch (RuntimeIOException e) {
System.err.println("Tree recording failed: " + e.getMessage());
throw e;
} Defensive patterns
Strategy: try-catch
Validate before calling
// before long runs
long usable = p.toFile().getUsableSpace();
if (usable < requiredBytes) throw new IllegalStateException("insufficient disk space: " + usable); Try / catch
try {
recorder.evaluate(query, gold, pw);
} catch (RuntimeIOException e) {
log.severe("Write failed while recording trees: " + e.getMessage());
throw e;
} Prevention
- Monitor free disk space during long evaluations
- Never delete or truncate the output file while open
- Write to reliable local filesystems
When it happens
Trigger: Calling recorder.evaluate(parserQuery, goldTree, pw) (or writeNewFile contents) after the output file/stream has become unwritable — disk full, file deleted/closed externally, underlying filesystem error.
Common situations: Long evaluation runs filling the disk mid-write; output file removed while the recorder is open; NFS/network filesystem dropped mid-session.
Understand the failure class
Background: "failed to write file", "Could not save figure", "Error saving remote file" — file write failed: causes and fixes across languages and libraries — this error's family across 38 libraries.
Related errors
- Error creating data exporter
- Serializing classifier to
- Error opening output file
- Exception in printToFile " + file.getAbsolutePath()
- Exception: in printToFile
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/184b5ff03fe53625.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/parser/shiftreduce/TreeRecorder.java:56
if (!(query instanceof ShiftReduceParserQuery)) {
throw new IllegalArgumentException("This evaluator only works for the ShiftReduceParser");
}
ShiftReduceParserQuery srquery = (ShiftReduceParserQuery) query;
try {
switch (mode) {
case BINARIZED:
out.write(srquery.getBestBinarizedParse().toString());
break;
case DEBINARIZED:
out.write(srquery.debinarized.toString());
break;
default:
throw new IllegalArgumentException("Unknown mode " + mode);
}
out.newLine();
} catch (IOException e) {
throw new RuntimeIOException(e);
}
}
public void display(boolean verbose, PrintWriter pw) {
try {
out.close();
} catch (IOException e) {
throw new RuntimeIOException(e);
}
}
}
View on GitHub (pinned to 1b7edd19c4)