{"record":{"id":"e1ddced89f6a958e","repo":"oracle/graal","slug":"unexpected-architecture-name-archname","errorCode":null,"errorMessage":"Unexpected architecture name ${archName}","messagePattern":"Unexpected architecture name (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/replaycomp/BinaryReplayCodec.java","lineNumber":1152,"sourceCode":"            case AMD64 ignored -> AMD64_ARCHITECTURE;\n            case RISCV64 ignored -> RISCV64_ARCHITECTURE;\n            case AArch64 ignored -> AARCH64_ARCHITECTURE;\n            default -> throw new IllegalArgumentException(\"Unexpected architecture \" + architecture);\n        };\n    }\n\n    private static void writeArchitectureFeatures(ObjectCopierOutputStream out, Architecture architecture) throws IOException {\n        switch (architecture) {\n            case AMD64 amd64 -> writeEnumOrdinals(out, amd64.getFeatures());\n            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        }","sourceCodeStart":1134,"sourceCodeEnd":1170,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/replaycomp/BinaryReplayCodec.java#L1134-L1170","documentation":"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.","triggerScenarios":"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.","commonSituations":"Replay files from an in-progress architecture port not yet listed in Platform.KNOWN_ARCHITECTURES; hand-edited configuration specifying an invalid arch name.","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"],"exampleFix":"// before\nArchitecture a = createFallbackArchitecture(\"arm64\"); // not a known name -> throws\n\n// after\nArchitecture a = createFallbackArchitecture(\"aarch64\"); // canonical name from Platform.KNOWN_ARCHITECTURES","handlingStrategy":"validation","validationCode":"static boolean knownArchitectureName(String name) {\n    return Platform.KNOWN_ARCHITECTURES.contains(name);\n}","typeGuard":null,"tryCatchPattern":"try {\n    Architecture a = createFallbackArchitecture(archName);\n} catch (IllegalArgumentException e) {\n    // unknown arch name: validate against Platform.KNOWN_ARCHITECTURES and correct the config\n}","preventionTips":["Use canonical names from Platform.KNOWN_ARCHITECTURES (e.g. 'aarch64', not 'arm64')","Validate arch names from configuration or replay headers before use"],"tags":["graalvm","replay-compilation","architecture","validation","configuration"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}