oracle/graal · error · IOException

Unknown replay architecture kind

Error message

Unknown replay architecture kind

What it means

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.

Source

Thrown at compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/replaycomp/BinaryReplayCodec.java:1162

            case RISCV64 riscv64 -> writeEnumOrdinals(out, riscv64.getFeatures());
            case AArch64 aarch64 -> writeEnumOrdinals(out, aarch64.getFeatures());
            default -> throw new IllegalArgumentException("Unexpected architecture " + architecture);
        }
    }

    private Architecture createFallbackArchitecture(String archName) {
        if (!Platform.KNOWN_ARCHITECTURES.contains(archName)) {
            throw new IllegalArgumentException("Unexpected architecture name " + archName);
        }
        return hostTarget.arch;
    }

    private static Architecture readArchitecture(ObjectCopierInputStream in) throws IOException {
        return switch (in.readPackedUnsignedInt()) {
            case AMD64_ARCHITECTURE -> new AMD64(readEnumOrdinals(in, AMD64.CPUFeature.class));
            case RISCV64_ARCHITECTURE -> new RISCV64(readEnumOrdinals(in, RISCV64.CPUFeature.class));
            case AARCH64_ARCHITECTURE -> new AArch64(readEnumOrdinals(in, AArch64.CPUFeature.class));
            default -> throw new IOException("Unknown replay architecture kind");
        };
    }

    private static void writeEnumOrdinals(ObjectCopierOutputStream out, EnumSet<?> enumSet) throws IOException {
        out.writePackedUnsignedInt(enumSet.size());
        for (Enum<?> constant : enumSet) {
            out.writePackedUnsignedInt(constant.ordinal());
        }
    }

    private static <E extends Enum<E>> EnumSet<E> readEnumOrdinals(ObjectCopierInputStream in, Class<E> enumClass) throws IOException {
        int size = in.readPackedUnsignedInt();
        EnumSet<E> enumSet = EnumSet.noneOf(enumClass);
        E[] constants = enumClass.getEnumConstants();
        for (int i = 0; i < size; i++) {
            int ordinal = in.readPackedUnsignedInt();
            if (ordinal < 0 || ordinal >= constants.length) {
                throw new IOException("Invalid ordinal " + ordinal + " for " + enumClass.getName());

View on GitHub (pinned to a66e9ccd1d)

Solutions

  1. Regenerate the replay file with the same GraalVM build used for replay
  2. Ensure the replaying build contains the architecture support matching the recording
  3. Bump the file VERSION when adding architecture kinds so old readers fail at the header
Defensive patterns

Strategy: try-catch

Try / catch

try {
    Architecture a = readArchitecture(in);
} catch (IOException e) {
    if ("Unknown replay architecture kind".equals(e.getMessage())) {
        // reader lacks this architecture: use a build matching the recording
    } else throw e;
}

Prevention

When it happens

Trigger: Replaying a file whose writer supported an architecture kind this reader lacks; misaligned or corrupted stream yielding a bogus kind int.

Common situations: Newer-writer/older-reader version mismatch; replaying files from a port branch that added an architecture kind.

Related errors


AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14). Data as JSON: /api/errors/ffc98104e9eef028. Report an issue: GitHub.