oracle/graal · error · IllegalStateException
InputGraph already contains InputNode with Id={}
Error message
InputGraph already contains InputNode with Id={} What it means
InputGraph.addNode stores nodes keyed by their integer id and rejects a second node with the same id. The IllegalStateException signals corrupt or duplicated input while a graph is being assembled (typically during graph-dump loading), preserving the id-uniqueness invariant other components rely on.
Source
Thrown at compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/graphio/parsing/model/InputGraph.java:406
return data().edges.size();
}
public Collection<InputNode> getNodes() {
return Collections.unmodifiableCollection(data().nodes.values());
}
public Set<Integer> getNodesAsSet() {
return Collections.unmodifiableSet(data().nodes.keySet());
}
public Collection<InputBlock> getBlocks() {
return Collections.unmodifiableCollection(data().blocks.values());
}
public void addNode(InputNode node) {
assert !isFrozen();
if (data().nodes.containsKey(node.getId())) {
throw new IllegalStateException("InputGraph already contains InputNode with Id=" + node.getId());
}
data().nodes.put(node.getId(), node);
if (data().highestNodeId < node.getId()) {
data().highestNodeId = node.getId();
}
nodeIds = null;
}
/**
* Highest node ID in the graph. Under assumption that node IDs are assigned sequentially
* (though some IDs may be missing), the value may allow some preallocations or optimizations.
* Returns -1 for empty graph with no nodes.
*
* @return highest node ID.
*/
public int getHighestNodeId() {
return data().highestNodeId;
}View on GitHub (pinned to a66e9ccd1d)
Solutions
- Before adding, check graph.findNode(id)/getNodesAsSet() and skip or re-map the id when it already exists
- Re-assign unique ids when merging graphs (use getHighestNodeId() as the starting offset)
- If loading from a dump, re-generate the dump from a healthy compilation instead of hand-editing it
Example fix
// before
graph.addNode(newNode); // id already present
// after
if (graph.getNodesAsSet().contains(newNode.getId())) {
newNode.setId(nextFreshId(graph));
}
graph.addNode(newNode); Defensive patterns
Strategy: validation
Validate before calling
if (graph.getNodesAsSet().contains(node.getId())) { /* skip, error out, or re-map id before addNode */ } Try / catch
try { graph.addNode(n); } catch (IllegalStateException e) { /* log dump corruption; abort load of this graph, keep others */ } Prevention
- Validate id uniqueness while parsing dump entries
- Re-map ids when merging graphs starting from getHighestNodeId()
- Never hand-edit NEW_NODE ids in .bgv dumps
When it happens
Trigger: Calling InputGraph.addNode(node) twice for the same InputNode id, or adding two distinct InputNodes with equal getId() while a dump is being parsed or a graph is built programmatically; also reachable when a lazy data() section is initialized twice from the same source.
Common situations: Loading a malformed/hand-edited .bgv dump where NEW_NODE entries repeat an id; merging two graphs by copying nodes without re-mapping ids; replay logic that re-adds nodes after a partial failure.
Related errors
- Cannot downgrade from minimum required version
- Feature unsupported in version
- Unrecognized version
- Dump properties unsupported in format v.
- Trying to write during graph print.
AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14).
Data as JSON: /api/errors/e7d85f7bb1ca8684.
Report an issue: GitHub.