{"record":{"id":"36c9ed33fb36fd6e","repo":"oracle/graal","slug":"unsupported-replay-file-version","errorCode":null,"errorMessage":"Unsupported replay file version ","messagePattern":"Unsupported replay file version ","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/replaycomp/BinaryReplayCodec.java","lineNumber":1060,"sourceCode":"            String value = readStringReference(in, state);\n            properties.put(key, value);\n        }\n        return properties;\n    }\n\n    private static void verifyHeader(ObjectCopierInputStream in) throws IOException {\n        for (byte expected : MAGIC) {\n            int actual = in.read();\n            if (actual < 0) {\n                throw new EOFException();\n            }\n            if (actual != Byte.toUnsignedInt(expected)) {\n                throw new IOException(\"Invalid replay file header\");\n            }\n        }\n        int version = in.readPackedUnsignedInt();\n        if (version != VERSION) {\n            throw new IOException(\"Unsupported replay file version \" + version);\n        }\n    }\n\n    private static void writeBooleanFlag(ObjectCopierOutputStream out, boolean value) throws IOException {\n        out.write(value ? 1 : 0);\n    }\n\n    private static boolean readBooleanFlag(ObjectCopierInputStream in) throws IOException {\n        int value = in.read();\n        if (value < 0) {\n            throw new EOFException();\n        }\n        return switch (value) {\n            case 0 -> false;\n            case 1 -> true;\n            default -> throw new IOException(\"Invalid replay boolean flag \" + value);\n        };\n    }","sourceCodeStart":1042,"sourceCodeEnd":1078,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/replaycomp/BinaryReplayCodec.java#L1042-L1078","documentation":"After the MAGIC bytes verify, verifyHeader reads a packed version int and compares it to the codec's VERSION constant. A mismatch throws IOException 'Unsupported replay file version <version>'. The version guards the whole binary layout: any change to tags or encoding bumps VERSION so stale files are rejected deterministically instead of producing random decode errors.","triggerScenarios":"Replaying a file recorded by an older or newer GraalVM build whose codec VERSION differs from the reader's.","commonSituations":"Upgrading GraalVM between recording a bug and replaying it; sharing replay files across teams on different builds; keeping old replay files in a test corpus after a codec format change.","solutions":["Re-record the replay file with the same GraalVM build that will replay it","Upgrade or downgrade the replaying JVM so its codec VERSION matches the file","If you must carry old files forward, write a migration tool that decodes with the old version and re-encodes"],"exampleFix":"// before\nverifyHeader(in); // throws mid-run on version mismatch\n\n// after\n// surface the mismatch clearly up front\nif (fileVersion != VERSION) {\n    throw new IOException(\"Replay file version \" + fileVersion + \" does not match codec version \" + VERSION + \"; re-record with this build\");\n}","handlingStrategy":"validation","validationCode":"static void assertVersionMatch(java.io.InputStream in, int codecVersion) throws IOException {\n    // assumes magic already consumed\n    int v = new ObjectCopierInputStream(in).readPackedUnsignedInt();\n    if (v != codecVersion) throw new IOException(\"Unsupported replay file version \" + v);\n}","typeGuard":null,"tryCatchPattern":"try {\n    codec.readReplay(in);\n} catch (IOException e) {\n    if (e.getMessage() != null && e.getMessage().startsWith(\"Unsupported replay file version\")) {\n        // re-record on this build or switch to the matching build\n    } else throw e;\n}","preventionTips":["Keep recording and replay environments on the same GraalVM version","Discard stored replay files after upgrading the codec VERSION; treat them as build-specific artifacts"],"tags":["graalvm","replay-compilation","version-mismatch","io","file-format"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}