stanfordnlp/CoreNLP · error · RuntimeIOException
Failed to find node " + ie.source + "-" + ie.sourceCopy
Error message
Failed to find node " + ie.source + "-" + ie.sourceCopy
What it means
AnnotationSerializer.convertIntermediateGraph rebuilds a SemanticGraph from serialized intermediate nodes and edges; it throws RuntimeIOException when an edge's source (nodeId-sourceCopy) is absent from the nodeMap, meaning the serialized dependency graph is internally inconsistent.
Solutions
- Check the chained cause and the serialized file for missing/renumbered nodes
- Regenerate the serialized annotations with the same (matching) Stanford CoreNLP version used for reading
- Ensure no custom Annotator/serialization hook removes nodes from the dependency graph without dropping dependent edges
- If copying documents between serializers, keep nodes and edges together
Example fix
// before // custom filter removed node 5 but kept its incoming edges // after // remove edges whose source/target nodes are removed, or skip node removal entirely
Defensive patterns
Strategy: try-catch
Validate before calling
// ensure writer and reader CoreNLP versions match
String expected = "4.5.0";
if (!Version.version().equals(expected))
log.warn("Version mismatch vs. serialized data: " + Version.version()); Try / catch
try {
deps = serializer.readAnnotations(...);
} catch (RuntimeIOException e) {
if (e.getMessage().startsWith("Failed to find node")) {
log.error("Inconsistent serialized graph: " + e.getMessage());
} else throw e;
} Prevention
- Use the same CoreNLP version for writing and reading
- Don't hand-edit serialized annotation files
- Keep node removal code synchronized with edge cleanup
When it happens
Trigger: Deserializing annotations where an IntermediateEdge references a source node id/copy that was never added to the node map — e.g. a corrupted or hand-modified serialized file, or nodes dropped by custom serialization filters.
Common situations: Version mismatch between the writing and reading CoreNLP versions changing node id assignment, manual post-processing of serialized output, dependency-conversion filters removing nodes still referenced by edges.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- Failed to find node " + ie.target + "-" + ie.targetCopy
- ERROR: Invalid dependency node line
- ERROR: Invalid format for dependency graph
- ERROR: Serialized data does not contain an Annotation!
- Unknown general relation
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/8318a1b439587e04.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/pipeline/AnnotationSerializer.java:165
if (word.sentIndex() < 0 && in.sentIndex >= 0) {
word.setSentIndex(in.sentIndex);
}
if (word.index() < 0 && in.index >= 0) {
word.setIndex(in.index);
}
nodeMap.put(word.index(), word.copyCount(), word);
graph.addVertex(word);
if (in.isRoot) {
graph.addRoot(word);
}
}
// add all edges to the actual graph
for (IntermediateEdge ie: edges) {
IndexedWord source = nodeMap.get(ie.source, ie.sourceCopy);
if (source == null) {
throw new RuntimeIOException("Failed to find node " + ie.source + "-" + ie.sourceCopy);
}
IndexedWord target = nodeMap.get(ie.target, ie.targetCopy);
if (target == null) {
throw new RuntimeIOException("Failed to find node " + ie.target + "-" + ie.targetCopy);
}
// assert(target != null);
synchronized (LOCK) {
// this is not thread-safe: there are static fields in GrammaticalRelation
GrammaticalRelation rel = GrammaticalRelation.valueOf(ie.dep);
graph.addEdge(source, target, rel, 1.0, ie.isExtra);
}
}
// compute root nodes if they weren't stored in the graph
if ( ! graph.isEmpty() && graph.getRoots().isEmpty()) {
graph.resetRoots();
}
View on GitHub (pinned to 1b7edd19c4)