stanfordnlp/CoreNLP · error · RuntimeIOException
Failed to find node " + ie.target + "-" + ie.targetCopy
Error message
Failed to find node " + ie.target + "-" + ie.targetCopy
What it means
RuntimeIOException from AnnotationSerializer's graph reconstruction when an edge references a node (source or target index-copy) that was not found in the deserialized node map — the serialized dependency graph is inconsistent or was produced by an incompatible version.
Solutions
- Regenerate the annotation file with a matching CoreNLP version
- Audit any custom serializer/filter code for node removal without edge cleanup
- Validate the file against the schema; look for the specific missing target id in the message
- Test with a fresh document serialized end-to-end to isolate writer vs. file corruption
Example fix
// before // filter drops punctuation nodes but leaves edges referencing them // after // drop edges alongside removed nodes: // edges.removeIf(e -> removed.contains(e.target));
Defensive patterns
Strategy: try-catch
Validate before calling
// pre-validate a deserialized graph
for (SemanticGraphEdge e : graph.edgeIterable()) {
if (e.getSource() == null || e.getTarget() == null)
throw new IllegalStateException("Dangling edge in graph");
} Try / catch
try {
graph = convertIntermediateGraph(nodes, edges);
} catch (RuntimeIOException e) {
if (e.getMessage().startsWith("Failed to find node")) {
log.error("Edge references missing node: " + e.getMessage());
} else throw e;
} Prevention
- Avoid custom serialization filters that prune nodes only
- Regenerate files after CoreNLP upgrades
- Validate serialized files against schema before loading
When it happens
Trigger: Deserializing a SemanticGraph whose IntermediateEdge target (nodeId, copy) has no matching node entry — corrupted file, writer/reader version mismatch, or custom code pruning nodes while keeping edges.
Common situations: Merging or truncating serialized annotation files, custom serialization pipelines that filter enhanced/ccprocessed dependencies, upgrading CoreNLP between serialization format changes.
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.source + "-" + ie.sourceCopy
- 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/2dae3595cde9e908.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/pipeline/AnnotationSerializer.java:169
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();
}
return graph;
}
}
View on GitHub (pinned to 1b7edd19c4)