{"record":{"id":"8318a1b439587e04","repo":"stanfordnlp/CoreNLP","slug":"failed-to-find-node-ie-source-ie-sourc","errorCode":null,"errorMessage":"Failed to find node \" + ie.source + \"-\" + ie.sourceCopy","messagePattern":"Failed to find node \" \\+ ie\\.source \\+ \"-\" \\+ ie\\.sourceCopy","errorType":"exception","errorClass":"RuntimeIOException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/pipeline/AnnotationSerializer.java","lineNumber":165,"sourceCode":"        if (word.sentIndex() < 0 && in.sentIndex >= 0) {\n          word.setSentIndex(in.sentIndex);\n        }\n        if (word.index() < 0 && in.index >= 0) {\n          word.setIndex(in.index);\n        }\n\n        nodeMap.put(word.index(), word.copyCount(), word);\n        graph.addVertex(word);\n        if (in.isRoot) {\n          graph.addRoot(word);\n        }\n      }\n\n      // add all edges to the actual graph\n      for (IntermediateEdge ie: edges) {\n        IndexedWord source = nodeMap.get(ie.source, ie.sourceCopy);\n        if (source == null) {\n          throw new RuntimeIOException(\"Failed to find node \" + ie.source + \"-\" + ie.sourceCopy);\n        }\n        IndexedWord target = nodeMap.get(ie.target, ie.targetCopy);\n        if (target == null) {\n          throw new RuntimeIOException(\"Failed to find node \" + ie.target + \"-\" + ie.targetCopy);\n        }\n        // assert(target != null);\n        synchronized (LOCK) {\n          // this is not thread-safe: there are static fields in GrammaticalRelation\n          GrammaticalRelation rel = GrammaticalRelation.valueOf(ie.dep);\n          graph.addEdge(source, target, rel, 1.0, ie.isExtra);\n        }\n      }\n\n      // compute root nodes if they weren't stored in the graph\n      if ( ! graph.isEmpty() && graph.getRoots().isEmpty()) {\n        graph.resetRoots();\n      }\n","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/pipeline/AnnotationSerializer.java#L147-L183","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\n// custom filter removed node 5 but kept its incoming edges\n// after\n// remove edges whose source/target nodes are removed, or skip node removal entirely","handlingStrategy":"try-catch","validationCode":"// ensure writer and reader CoreNLP versions match\nString expected = \"4.5.0\";\nif (!Version.version().equals(expected))\n  log.warn(\"Version mismatch vs. serialized data: \" + Version.version());","typeGuard":null,"tryCatchPattern":"try {\n  deps = serializer.readAnnotations(...);\n} catch (RuntimeIOException e) {\n  if (e.getMessage().startsWith(\"Failed to find node\")) {\n    log.error(\"Inconsistent serialized graph: \" + e.getMessage());\n  } else throw e;\n}","preventionTips":["Use the same CoreNLP version for writing and reading","Don't hand-edit serialized annotation files","Keep node removal code synchronized with edge cleanup"],"tags":["serialization","dependency-graph","deserialization","java"],"backgroundTag":"internal-invariant-violation","analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}