oracle/graal · error · IllegalArgumentException

Property count is too big. Properties can contain only

Error message

Property count is too big. Properties can contain only 

What it means

GraphProtocol.writeProperties encodes the property count as a 16-bit short for protocol versions below 8. If a graph or node carries Character.MAX_VALUE (65535) or more properties and the protocol version is 7.x or older, the count cannot be represented and an IllegalArgumentException is thrown. Version 8 added a wide encoding (writeShort(MAX_VALUE) marker followed by a 32-bit count) specifically to lift this limit.

Source

Thrown at compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/graphio/GraphProtocol.java:850

                writeByte(PROPERTY_SUBGRAPH);
                writeGraph(g, null);
            }
        }
    }

    private void writeProperties(Graph graph, Map<? extends Object, ? extends Object> props) throws IOException {
        if (props == null) {
            writeShort((char) 0);
            return;
        }
        final int size = props.size();
        // properties
        if (size >= Character.MAX_VALUE) {
            if (versionMajor > 7) {
                writeShort(Character.MAX_VALUE);
                writeInt(size);
            } else {
                throw new IllegalArgumentException("Property count is too big. Properties can contain only " + (Character.MAX_VALUE - 1) + " in version < 8.");
            }
        } else {
            writeShort((char) size);
        }
        int cnt = 0;
        for (Map.Entry<? extends Object, ? extends Object> entry : props.entrySet()) {
            String key = entry.getKey().toString();
            writePoolObject(key);
            writePropertyObject(graph, entry.getValue());
            cnt++;
        }
        if (size != cnt) {
            throw new IOException("Expecting " + size + " properties, but found only " + cnt);
        }
    }

    private static boolean isFound(Object obj, Object[] found) {
        if (obj == null) {

View on GitHub (pinned to a66e9ccd1d)

Solutions

  1. Construct the GraphProtocol with major version 8 (or later) so the extended 32-bit property count encoding is used.
  2. Reduce the number of properties below 65535 by pruning debug/redundant entries before dumping.
  3. If the reader side must stay on version < 8, filter properties to a whitelist before serialization and keep the count bounded.

Example fix

// before
try (GraphProtocol p = new MyProtocol(out, 7, 0)) { // throws for >= 65535 props
    p.dump(graph);
}

// after
try (GraphProtocol p = new MyProtocol(out, 8, 0)) { // wide count encoding
    p.dump(graph);
}
Defensive patterns

Strategy: validation

Validate before calling

if (props.size() >= Character.MAX_VALUE && protocol.getMajorVersion() < 8) {
    throw new IllegalArgumentException("Reduce properties or use protocol version >= 8");
}

Try / catch

try { p.writeProperties(graph, props); } catch (IllegalArgumentException e) { /* fall back to pruning properties below 65535 or bump version */ }

Prevention

When it happens

Trigger: Calling GraphProtocol.dump/write with a properties Map of size >= 65535 while the GraphProtocol instance was constructed with a major version < 8; extremely wide node property sets (e.g. generated or debug-heavy graphs) dumped through an old-version protocol handle.

Common situations: Tools pinned to protocol version 7 for compatibility with older Ideal Graph Visualizer (IGV) builds; programmatically generated graphs where each node accumulates thousands of properties; mixed environments where the reader only supports < 8 so the writer version was deliberately lowered.

Related errors


AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14). Data as JSON: /api/errors/93e2941d3bbd6c0f. Report an issue: GitHub.