{"record":{"id":"ffc98104e9eef028","repo":"oracle/graal","slug":"unknown-replay-architecture-kind","errorCode":null,"errorMessage":"Unknown replay architecture kind","messagePattern":"Unknown replay architecture kind","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/replaycomp/BinaryReplayCodec.java","lineNumber":1162,"sourceCode":"            case RISCV64 riscv64 -> writeEnumOrdinals(out, riscv64.getFeatures());\n            case AArch64 aarch64 -> writeEnumOrdinals(out, aarch64.getFeatures());\n            default -> throw new IllegalArgumentException(\"Unexpected architecture \" + architecture);\n        }\n    }\n\n    private Architecture createFallbackArchitecture(String archName) {\n        if (!Platform.KNOWN_ARCHITECTURES.contains(archName)) {\n            throw new IllegalArgumentException(\"Unexpected architecture name \" + archName);\n        }\n        return hostTarget.arch;\n    }\n\n    private static Architecture readArchitecture(ObjectCopierInputStream in) throws IOException {\n        return switch (in.readPackedUnsignedInt()) {\n            case AMD64_ARCHITECTURE -> new AMD64(readEnumOrdinals(in, AMD64.CPUFeature.class));\n            case RISCV64_ARCHITECTURE -> new RISCV64(readEnumOrdinals(in, RISCV64.CPUFeature.class));\n            case AARCH64_ARCHITECTURE -> new AArch64(readEnumOrdinals(in, AArch64.CPUFeature.class));\n            default -> throw new IOException(\"Unknown replay architecture kind\");\n        };\n    }\n\n    private static void writeEnumOrdinals(ObjectCopierOutputStream out, EnumSet<?> enumSet) throws IOException {\n        out.writePackedUnsignedInt(enumSet.size());\n        for (Enum<?> constant : enumSet) {\n            out.writePackedUnsignedInt(constant.ordinal());\n        }\n    }\n\n    private static <E extends Enum<E>> EnumSet<E> readEnumOrdinals(ObjectCopierInputStream in, Class<E> enumClass) throws IOException {\n        int size = in.readPackedUnsignedInt();\n        EnumSet<E> enumSet = EnumSet.noneOf(enumClass);\n        E[] constants = enumClass.getEnumConstants();\n        for (int i = 0; i < size; i++) {\n            int ordinal = in.readPackedUnsignedInt();\n            if (ordinal < 0 || ordinal >= constants.length) {\n                throw new IOException(\"Invalid ordinal \" + ordinal + \" for \" + enumClass.getName());","sourceCodeStart":1144,"sourceCodeEnd":1180,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/replaycomp/BinaryReplayCodec.java#L1144-L1180","documentation":"readArchitecture decodes the architecture kind packed int at the start of an architecture record; only AMD64_ARCHITECTURE, RISCV64_ARCHITECTURE and AARCH64_ARCHITECTURE are recognized, anything else throws IOException 'Unknown replay architecture kind'. As with other unknown-kind errors, the value can only be out of range through version skew or stream corruption.","triggerScenarios":"Replaying a file whose writer supported an architecture kind this reader lacks; misaligned or corrupted stream yielding a bogus kind int.","commonSituations":"Newer-writer/older-reader version mismatch; replaying files from a port branch that added an architecture kind.","solutions":["Regenerate the replay file with the same GraalVM build used for replay","Ensure the replaying build contains the architecture support matching the recording","Bump the file VERSION when adding architecture kinds so old readers fail at the header"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    Architecture a = readArchitecture(in);\n} catch (IOException e) {\n    if (\"Unknown replay architecture kind\".equals(e.getMessage())) {\n        // reader lacks this architecture: use a build matching the recording\n    } else throw e;\n}","preventionTips":["Replay on a build that supports the recording's architecture","Bump VERSION when adding architecture kinds to the codec"],"tags":["graalvm","replay-compilation","architecture","deserialization","version-skew"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}