oracle/graal · error · IOException
Too many nodes in list:
Error message
Too many nodes in list:
What it means
The dump protocol writes the length of a plural (indirect) edge list as a single 16-bit short. writeEdges therefore rejects any edge list whose size does not round-trip through a char (i.e. > 65535) with IOException('Too many nodes in list'). This mirrors NodeList.checkMaxSize on the compiler side: the wire format itself cannot express larger lists.
Source
Thrown at compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/graphio/GraphProtocol.java:580
int size = findSize(edges);
for (int i = 0; i < size; i++) {
Collection<? extends Node> list = findNodes(graph, node, edges, i);
if (isDirect(edges, i)) {
if (list != null && list.size() != 1) {
throw new IOException("Edge " + i + " in " + edges + " is direct, but list isn't singleton: " + list);
}
Node n = null;
if (list != null && !list.isEmpty()) {
n = list.iterator().next();
}
writeNodeRef(n);
} else {
if (list == null) {
writeShort((char) 0);
} else {
int listSize = list.size();
if (listSize != ((char) listSize)) {
throw new IOException("Too many nodes in list: " + list.size());
}
writeShort((char) listSize);
for (Node edge : list) {
writeNodeRef(edge);
}
}
}
}
}
private NodeClass classForNode(Node node) throws IOException {
NodeClass clazz = findClassForNode(node);
if (clazz == null) {
throw new IOException("No class for " + node);
}
return clazz;
}
View on GitHub (pinned to a66e9ccd1d)
Solutions
- Restructure the input so no single node list exceeds 65535 entries (split merges/calls, chunk generated code).
- Check for a phase bug that grows a list unboundedly before assuming the input is genuinely huge.
- Disable or scope down graph dumping (-Dgraal.Dump=) for the affected method if the dump is optional and compilation itself is fine.
- Verify whether compilation also hits NodeList's PermanentBailoutException — same root limit, fix the shape once for both.
Example fix
// generated shape triggering it // before Node giant = graph.add(new MergeNode()); for (int i = 0; i < 100_000; i++) giant.addPredecessor(end(i)); // > 65535 in one list // after // chunk predecessors into nested merges of <= 50k each so every list fits a short
Defensive patterns
Strategy: try-catch
Validate before calling
static final int MAX_WIRE_LIST = 0xFFFF;
for (Node n : graph.getNodes()) {
for (Node input : n.inputs()) { /* count per-edge list sizes */ }
}
// simplest guard: reject/split shapes where any single edge list exceeds 65535 before enabling dumps Try / catch
try {
output.print(graph, ...);
} catch (IOException e) {
if (e.getMessage().startsWith("Too many nodes in list")) {
// graph shape exceeds the 16-bit wire limit: skip dumping this graph, fix the shape at the source
log.fine("Undumpable graph (edge list > 65535): " + e.getMessage());
} else throw e;
} Prevention
- Cap fan-in in generated code so no edge list can approach 65535.
- Scope -Dgraal.Dump to specific methods when dumping huge generated workloads.
- Remember the same limit triggers PermanentBailoutException at compile time — fix the shape once.
When it happens
Trigger: Dumping a graph where one node holds more than 65535 entries in a single input/usage list — giant merges, huge call argument lists, or exploded FrameStates from machine-generated code. The compile itself may have already bailed out (PermanentBailoutException at NodeList construction); this error appears when such a shape only arises at dump time or during debug dumping.
Common situations: Debug-dumping compilation of generated code (templating/DSL output) with very large methods. Enabling graph dumps (-Dgraal.Dump) on workloads with pathological graph shapes. Custom phases that accidentally accumulate unbounded entries into one node's list.
Related errors
- Number of elements in a node list too high: %d
- Cannot downgrade from minimum required version
- Feature unsupported in 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/61696d4b6b7ab3b9.
Report an issue: GitHub.