oracle/graal · error · IllegalStateException

Unexpected value: ${name}

Error message

Unexpected value: ${name}

What it means

ArchitectureSerializer.deserialize reconstructs the Architecture from a 'name' string; only 'AMD64', 'riscv64', and 'aarch64' are recognized. An unknown name throws IllegalStateException('Unexpected value: ...'). Note this happens during deserialization of the replay file's architecture section, so it fails before any compilation replay starts.

Source

Thrown at compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/replaycomp/JsonReplayCodec.java:1638

        }

        @Override
        public void serialize(Object instance, JsonBuilder.ObjectBuilder objectBuilder, RecursiveSerializer serializer) throws IOException {
            Architecture architecture = (Architecture) instance;
            objectBuilder.append("name", architecture.getName());
            serializer.serialize(architecture.getFeatures(), objectBuilder.append("features"));
        }

        @Override
        @SuppressWarnings("unchecked")
        public Object deserialize(EconomicMap<String, Object> json, RecursiveDeserializer deserializer, CompilationProxies.ProxyFactory proxyFactory) throws DeserializationException {
            String name = (String) json.get("name");
            EnumSet<?> features = (EnumSet<?>) deserializer.deserialize(json.get("features"), proxyFactory);
            Architecture architecture = switch (name) {
                case "AMD64" -> new AMD64((EnumSet<AMD64.CPUFeature>) features);
                case "riscv64" -> new RISCV64((EnumSet<RISCV64.CPUFeature>) features);
                case "aarch64" -> new AArch64((EnumSet<AArch64.CPUFeature>) features);
                default -> throw new IllegalStateException("Unexpected value: " + name);
            };
            deserializer.setArchitecture(architecture);
            return architecture;
        }
    }

    private static final class RegisterConfigSerializer implements ObjectSerializer {
        private final boolean isHostWindowsOS;

        private final TargetDescription hostTarget;

        private RegisterConfigSerializer(Platform platform, TargetDescription hostTarget) {
            this.isHostWindowsOS = platform.osName().equals("windows");
            this.hostTarget = hostTarget;
        }

        @Override
        public boolean serializesSubclasses() {

View on GitHub (pinned to a66e9ccd1d)

Solutions

  1. Replay the file on a JVM whose architecture matches the file's name field
  2. Re-record the file with the same build
  3. For fork maintainers adding a target: add a case to the switch and mirror it in the register-config deserializer
Defensive patterns

Strategy: validation

Validate before calling

static final Set<String> SUPPORTED_ARCHITECTURES = Set.of("AMD64", "riscv64", "aarch64");

String archName = (String) replayJson.getArchitectureName();
if (!SUPPORTED_ARCHITECTURES.contains(archName)) {
    throw new IllegalArgumentException("Unsupported replay architecture: " + archName);
}

Prevention

When it happens

Trigger: Replaying a JSON replay file whose architecture.name is anything but the three supported strings — recorded on another architecture (e.g. a future RISC-V variant name), written by a newer codec, or corrupted.

Common situations: Cross-architecture replay attempts; GraalVM version where Architecture.name() strings changed or new targets were added; hand-edited files.

Related errors


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