{"record":{"id":"370c09089f551b9d","repo":"oracle/graal","slug":"unrecognized-version","errorCode":null,"errorMessage":"Unrecognized version ","messagePattern":"Unrecognized version ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/graphio/GraphProtocol.java","lineNumber":94,"sourceCode":"    private static final int KLASS = 0x00;\n    private static final int ENUM_KLASS = 0x01;\n\n    private static final byte[] MAGIC_BYTES = {'B', 'I', 'G', 'V'};\n\n    private static final int MAJOR_VERSION = 8;\n    private static final int MINOR_VERSION = 0;\n\n    private final ConstantPool constantPool;\n    private final ByteBuffer buffer;\n    private final WritableByteChannel channel;\n    private final boolean embedded;\n    final int versionMajor;\n    final int versionMinor;\n    private boolean printing;\n\n    GraphProtocol(WritableByteChannel channel, int major, int minor, boolean embedded) throws IOException {\n        if (major > MAJOR_VERSION || (major == MAJOR_VERSION && minor > MINOR_VERSION)) {\n            throw new IllegalArgumentException(\"Unrecognized version \" + major + \".\" + minor);\n        }\n        this.versionMajor = major;\n        this.versionMinor = minor;\n        this.constantPool = new ConstantPool();\n        this.buffer = ByteBuffer.allocateDirect(256 * 1024);\n        this.channel = channel;\n        this.embedded = embedded;\n        if (!embedded) {\n            writeVersion();\n            flushEmbedded();\n        }\n    }\n\n    GraphProtocol(GraphProtocol<?, ?, ?, ?, ?, ?, ?, ?, ?, ?> parent) {\n        this.versionMajor = parent.versionMajor;\n        this.versionMinor = parent.versionMinor;\n        this.constantPool = parent.constantPool;\n        this.buffer = parent.buffer;","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/graphio/GraphProtocol.java#L76-L112","documentation":"GraphProtocol is the wire encoder for graph dumps; its constructor validates that the requested (major, minor) version does not exceed the encoder's own implemented maximum (MAJOR_VERSION.MINOR_VERSION). A version above what this class knows cannot be encoded, so it throws IllegalArgumentException('Unrecognized version M.m'). This protects against writing a dump stream the encoder itself could not have produced.","triggerScenarios":"Constructing a GraphProtocol/GraphOutput with a major version greater than GraphProtocol's compiled-in MAJOR_VERSION, or an equal major with a higher minor. Typically happens when caller-side version constants come from a newer graphio library than the GraphProtocol class performing the encoding (split jars / mixed classpath).","commonSituations":"Classpath mixing old and new Graal/graphio jars after a partial upgrade. Forward-porting code that assumes a future protocol version. Passing an arbitrary 'latest' version constant without checking the library's supported maximum.","solutions":["Align jar versions so the code choosing the protocol version and the GraphProtocol class implementing it come from the same release.","Request a version at or below the library's supported maximum (check GraphProtocol's constants in your dependency).","When in doubt, omit the version and let the builder default to the encoder's maximum supported version."],"exampleFix":"// before\noutput = builder.protocolVersion(8, 0).build(); // encoder only knows up to 7.x\n\n// after\noutput = builder.build(); // auto-select highest mutually supported version","handlingStrategy":"validation","validationCode":"// keep version selection inside one library version; or verify against the encoder's maximum before building\n// GraphProtocol's maximum is package-private; practically: let the Builder choose, don't pass hand-picked future versions.","typeGuard":null,"tryCatchPattern":"try {\n    output = builder.protocolVersion(major, minor).build();\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Unrecognized version\")) {\n        output = builder.build(); // fall back to the encoder's own maximum\n    } else throw e;\n}","preventionTips":["Keep compiler and graphio artifacts from a single coordinated release; avoid mixed classpaths.","Never hard-code protocol versions from a newer release into code running against an older jar.","Use dependency convergence checks so old graphio jars do not shadow new ones."],"tags":["java","graal","graphio","protocol-version","version-mismatch","classpath"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}