oracle/graal · error · IllegalArgumentException
Unexpected architecture name ${archName}
Error message
Unexpected architecture name ${archName} What it means
createFallbackArchitecture validates the architecture name string (e.g. from a replay header or target spec) against Platform.KNOWN_ARCHITECTURES; an unknown name throws IllegalArgumentException 'Unexpected architecture name <archName>'. The check guards the fallback path that substitutes the host architecture when the replayed target cannot be reconstructed exactly.
Source
Thrown at compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/replaycomp/BinaryReplayCodec.java:1152
case AMD64 ignored -> AMD64_ARCHITECTURE;
case RISCV64 ignored -> RISCV64_ARCHITECTURE;
case AArch64 ignored -> AARCH64_ARCHITECTURE;
default -> throw new IllegalArgumentException("Unexpected architecture " + architecture);
};
}
private static void writeArchitectureFeatures(ObjectCopierOutputStream out, Architecture architecture) throws IOException {
switch (architecture) {
case AMD64 amd64 -> writeEnumOrdinals(out, amd64.getFeatures());
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());
}View on GitHub (pinned to a66e9ccd1d)
Solutions
- Use a canonical architecture name exactly as listed in Platform.KNOWN_ARCHITECTURES
- Re-record the replay file on a build whose Platform knows the architecture
- If porting, add the new arch name to Platform.KNOWN_ARCHITECTURES before replaying
Example fix
// before
Architecture a = createFallbackArchitecture("arm64"); // not a known name -> throws
// after
Architecture a = createFallbackArchitecture("aarch64"); // canonical name from Platform.KNOWN_ARCHITECTURES Defensive patterns
Strategy: validation
Validate before calling
static boolean knownArchitectureName(String name) {
return Platform.KNOWN_ARCHITECTURES.contains(name);
} Try / catch
try {
Architecture a = createFallbackArchitecture(archName);
} catch (IllegalArgumentException e) {
// unknown arch name: validate against Platform.KNOWN_ARCHITECTURES and correct the config
} Prevention
- Use canonical names from Platform.KNOWN_ARCHITECTURES (e.g. 'aarch64', not 'arm64')
- Validate arch names from configuration or replay headers before use
When it happens
Trigger: Replaying data whose recorded architecture name is not one of the known architectures (typo, new port name, or corrupted string); invoking the fallback with an arbitrary arch string.
Common situations: Replay files from an in-progress architecture port not yet listed in Platform.KNOWN_ARCHITECTURES; hand-edited configuration specifying an invalid arch name.
Related errors
- Invalid replay boolean flag
- Unknown registration
- Required replay field is null
- Unexpected architecture ${architecture}
- Unknown replay architecture kind
AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14).
Data as JSON: /api/errors/e1ddced89f6a958e.
Report an issue: GitHub.