{"record":{"id":"5b50979a0c7f26fc","repo":"oracle/graal","slug":"invalid-constant-pool-index","errorCode":null,"errorMessage":"Invalid constant pool index : ","messagePattern":"Invalid constant pool index : ","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/graphio/parsing/BinaryReader.java","lineNumber":602,"sourceCode":"        for (int i = 0; i < len; i++) {\n            props[i] = readPoolObject(Object.class);\n        }\n        return props;\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    private <T> T readPoolObject(Class<T> klass) throws IOException {\n        int type = dataSource.readByte();\n        if (type == POOL_NULL) {\n            return null;\n        }\n        if (type == POOL_NEW) {\n            return (T) addPoolEntry(klass);\n        }\n        assert assertObjectType(klass, type) : \"Wrong object type : \" + klass + \" != \" + type;\n        char index = dataSource.readShort();\n        if (index >= constantPool.size()) {\n            throw new IOException(\"Invalid constant pool index : \" + index);\n        }\n        Object obj = getPoolData(index);\n        return (T) obj;\n    }\n\n    private Object getPoolData(int index) {\n        return constantPool.get(index, -1);\n    }\n\n    private static boolean assertObjectType(Class<?> klass, int type) {\n        switch (type) {\n            case POOL_CLASS:\n                return klass.isAssignableFrom(EnumKlass.class);\n            case POOL_ENUM:\n                return klass.isAssignableFrom(EnumValue.class);\n            case POOL_METHOD:\n                return klass.isAssignableFrom(Method.class);\n            case POOL_STRING:","sourceCodeStart":584,"sourceCodeEnd":620,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/graphio/parsing/BinaryReader.java#L584-L620","documentation":"When reading a pooled object reference, BinaryReader reads a type tag and a 16-bit index into the constant pool it built while parsing. If the index is beyond the pool's current size, the stream references an entry that was never written: the file is corrupted, truncated, or was written/offset in a way that desynchronized the reader from the writer's encoding. The IOException stops parsing because any subsequent reads would be based on unknown data.","triggerScenarios":"Feeding a BGV/BIGV file that was truncated mid-dump; concatenating or splicing graph files incorrectly; reading a file produced by a writer with a different pool-encoding bug; using a skip/seek offset (SkipRootException handling) that lands in the middle of an entry.","commonSituations":"Reading partially-flushed dump files (a compiler crash while dumping), transferring files without verifying integrity, or a producer/consumer version mismatch that changes entry layouts.","solutions":["Regenerate the graph dump and verify the producer finished writing (look for complete dump close in producer logs).","Verify file integrity (size, checksum/SHA-1 digest the format supports) before parsing.","Ensure producer and consumer run compatible graphio protocol versions (check the file's version header).","If concatenating BGV files, use the documented stream-concatenation support (each chunk carries its own BIGV header) rather than raw byte splicing."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { reader.parse(); } catch (IOException e) { if (e.getMessage().startsWith(\"Invalid constant pool index\")) { reportCorruptFile(); } throw e; }","preventionTips":["Verify dump completeness (producer finished) and file size before parsing.","Keep producer and consumer graphio versions aligned.","Use binary-safe transfer for BGV files."],"tags":["graphio","parsing","corrupt-input","constant-pool"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}