stanfordnlp/CoreNLP · warning · RuntimeIOException
RuntimeIOException wrapping IOException from close
Error message
RuntimeIOException wrapping IOException from close
What it means
TreeRecorder.display is the cleanup hook that closes the underlying BufferedWriter; a checked IOException during close is rethrown as RuntimeIOException. Close can fail when flushing buffered data to disk, so this error usually means earlier writes could not be fully persisted.
Solutions
- Ensure adequate disk space before and during the recording run
- Call display()/close() exactly once per TreeRecorder instance
- Use try/finally so close is attempted and any RuntimeIOException is logged with context
- Check the filesystem has not gone read-only (dmesg/mount output) if errors persist
Example fix
// before
recorder.display(verbose, pw);
// after
try {
recorder.display(verbose, pw);
} catch (RuntimeIOException e) {
System.err.println("Failed to close tree output: " + e.getMessage());
} Defensive patterns
Strategy: try-catch
Validate before calling
if (p.toFile().getUsableSpace() == 0) throw new IllegalStateException("disk full before close"); Try / catch
try {
recorder.display(verbose, pw);
} catch (RuntimeIOException e) {
log.warning("Error closing TreeRecorder: " + e.getMessage());
} Prevention
- Close each recorder exactly once
- Ensure sufficient disk space for buffered flushes
- Use try/finally to guarantee close on all paths
When it happens
Trigger: Calling recorder.display(verbose, pw) (which calls out.close()) when the output stream cannot be flushed — disk full, stream already closed/corrupted, or filesystem failure.
Common situations: Disk filled during evaluation so the final buffer flush fails; double-closing the recorder after a prior failure; container filesystem that has gone read-only.
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
- argsToProperties could not read properties file: " + file
- Cannot find or open + sentFileName
- Could not create directory <tgtDir.getAbsolutePath()>, as a…
- Could not create directory <tgtDir.getAbsolutePath()>
- Could not open jar file:
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/62c8bdcee9af4ba2.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/parser/shiftreduce/TreeRecorder.java:64
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)