{"record":{"id":"93e2941d3bbd6c0f","repo":"oracle/graal","slug":"property-count-is-too-big-properties-can-contain","errorCode":null,"errorMessage":"Property count is too big. Properties can contain only ","messagePattern":"Property count is too big\\. Properties can contain only ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/graphio/GraphProtocol.java","lineNumber":850,"sourceCode":"                writeByte(PROPERTY_SUBGRAPH);\n                writeGraph(g, null);\n            }\n        }\n    }\n\n    private void writeProperties(Graph graph, Map<? extends Object, ? extends Object> props) throws IOException {\n        if (props == null) {\n            writeShort((char) 0);\n            return;\n        }\n        final int size = props.size();\n        // properties\n        if (size >= Character.MAX_VALUE) {\n            if (versionMajor > 7) {\n                writeShort(Character.MAX_VALUE);\n                writeInt(size);\n            } else {\n                throw new IllegalArgumentException(\"Property count is too big. Properties can contain only \" + (Character.MAX_VALUE - 1) + \" in version < 8.\");\n            }\n        } else {\n            writeShort((char) size);\n        }\n        int cnt = 0;\n        for (Map.Entry<? extends Object, ? extends Object> entry : props.entrySet()) {\n            String key = entry.getKey().toString();\n            writePoolObject(key);\n            writePropertyObject(graph, entry.getValue());\n            cnt++;\n        }\n        if (size != cnt) {\n            throw new IOException(\"Expecting \" + size + \" properties, but found only \" + cnt);\n        }\n    }\n\n    private static boolean isFound(Object obj, Object[] found) {\n        if (obj == null) {","sourceCodeStart":832,"sourceCodeEnd":868,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/graphio/GraphProtocol.java#L832-L868","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Construct the GraphProtocol with major version 8 (or later) so the extended 32-bit property count encoding is used.","Reduce the number of properties below 65535 by pruning debug/redundant entries before dumping.","If the reader side must stay on version < 8, filter properties to a whitelist before serialization and keep the count bounded."],"exampleFix":"// before\ntry (GraphProtocol p = new MyProtocol(out, 7, 0)) { // throws for >= 65535 props\n    p.dump(graph);\n}\n\n// after\ntry (GraphProtocol p = new MyProtocol(out, 8, 0)) { // wide count encoding\n    p.dump(graph);\n}","handlingStrategy":"validation","validationCode":"if (props.size() >= Character.MAX_VALUE && protocol.getMajorVersion() < 8) {\n    throw new IllegalArgumentException(\"Reduce properties or use protocol version >= 8\");\n}","typeGuard":null,"tryCatchPattern":"try { p.writeProperties(graph, props); } catch (IllegalArgumentException e) { /* fall back to pruning properties below 65535 or bump version */ }","preventionTips":["Prefer constructing GraphProtocol with major version >= 8 unless an old reader forces otherwise.","Cap the number of properties attached to nodes/graphs in your model.","When forced to version < 8, filter properties through a whitelist before dump."],"tags":["graphio","serialization","properties","versioning","limits"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}