stanfordnlp/CoreNLP · error · RuntimeIOException
MemoryTreebank.processFile IOException in file
Error message
MemoryTreebank.processFile IOException in file <file>
What it means
MemoryTreebank.processFile reads parse trees from a file, and any IOException raised while reading (disk error, unreadable file, premature EOF mid-tree) is wrapped in a RuntimeIOException identifying the offending file. The library converts the checked exception to runtime form so treebank processing can proceed unchecked.
Solutions
- Verify the file exists and is readable (ls -l, permissions) and re-run; catch RuntimeIOException around load calls to skip bad files.
- Check disk/network health if the file is on a mount; re-copy the file locally before processing.
- Validate the file is complete (not truncated) — compare size/checksum with the source corpus.
- If files may vanish during batch processing, snapshot the file list and check File.canRead() before load.
Example fix
// before
MemoryTreebank tb = new MemoryTreebank();
tb.loadPath(path); // throws RuntimeIOException on bad file
// after
MemoryTreebank tb = new MemoryTreebank();
File f = new File(path);
if (!f.canRead()) { log.warn("Skipping unreadable file: " + path); return; }
try { tb.load(f); } catch (RuntimeIOException e) { log.error("Skipping: " + path, e); } Defensive patterns
Strategy: try-catch
Validate before calling
File f = new File(path);
if (!f.isFile() || !f.canRead()) {
throw new IllegalArgumentException("Unreadable treebank file: " + path);
} Try / catch
try {
treebank.load(new File(path));
} catch (RuntimeIOException e) {
log.error("Failed to read treebank file " + path + ": " + e.getMessage());
// skip or retry with a local copy
} Prevention
- Copy corpus files to local disk before batch processing instead of reading from network shares.
- Check File.canRead() and file integrity (size/checksum) before loading.
- Wrap per-file loads so one bad file doesn't abort the whole treebank run.
When it happens
Trigger: Calling MemoryTreebank.load/processFile/loadPath on a file that disappears or becomes unreadable during reading, an I/O device error, or a truncated/corrupt file causing the underlying reader to fail mid-tree.
Common situations: Reading from network mounts or removable drives that drop the file; permission changes mid-run; files listed by loadPath deleted before processing; NFS stale handles.
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
- Could not read from double initial LOP scales file
- Could not read from double initial weight file
- Could not read from float initial weight file
- edu.stanford.nlp.io.RuntimeIOException
- error loading
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/11027c82e9b19e25.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/trees/MemoryTreebank.java:305
// break;
// }
// }
// if (allNone) {
// fl.set(SRLIDAnnotation.class, SRL_ID.ALL_NO);
// } else {
// fl.set(SRLIDAnnotation.class, SRL_ID.NO);
// }
// }
// }
// parseTrees.add(t);
}
}
}
sentIndex++;
}
} catch (IOException e) {
throw new RuntimeIOException("MemoryTreebank.processFile IOException in file " + file, e);
} finally {
IOUtils.closeIgnoringExceptions(tr);
}
}
/**
* Load a collection of parse trees from a Reader.
* Each tree may optionally be encased in parens to allow for Penn
* Treebank style trees.
*
* @param r The reader to read trees from. (If you want it buffered,
* you should already have buffered it!)
*/
public void load(Reader r) {
load(r, null);
}
View on GitHub (pinned to 1b7edd19c4)