{"record":{"id":"6f3fa188c106cae0","repo":"oracle/graal","slug":"unsupported-architecture-s-s","errorCode":null,"errorMessage":"Unsupported architecture %s: %s","messagePattern":"Unsupported architecture (.+?): (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/disassembler/MachCode.java","lineNumber":111,"sourceCode":"            if (newHsErrContent.equals(hsErrContent)) {\n                System.out.printf(\"No MachCode sections in %s or they could not be disassembled: %s%n\", hsErr, fr.getReason());\n            } else {\n                Path newHsErrFile = Paths.get(hsErrFile + \".dis\");\n                Files.write(newHsErrFile, newHsErrContent.getBytes(StandardCharsets.UTF_8));\n                System.out.println(\" In: \" + hsErrFile);\n                System.out.println(\"Out: \" + newHsErrFile);\n            }\n        }\n    }\n\n    private static Disassembler fromArch(String arch, String message) {\n        if (arch.equals(\"x86_64\") || arch.equals(\"amd64\") || arch.equals(\"x64\")) {\n            return new HotSpotDisassembler(Disassembler.Architecture.AMD64);\n        }\n        if (arch.equals(\"aarch64\")) {\n            return new HotSpotDisassembler(Disassembler.Architecture.AArch64);\n        }\n        throw new IllegalArgumentException(String.format(\"Unsupported architecture %s: %s\", arch, message));\n    }\n\n    /**\n     * Gets a {@link Disassembler} instance that can disassemble machine code for the CPU type\n     * specified heuristic probing of {@code input} based on typical patterns found in hs_err logs\n     * or .jtr files. If heuristic probing fails and {@code userArch != null}, then it is used\n     * otherwise the {@code machcode.arch} or {@code os.arch} system property is used.\n     *\n     * @param log if non-null, log messages are printed here\n     */\n    public static Disassembler initDisassembler(String inputName, String input, PrintStream log, String userArch) {\n        if (userArch != null) {\n            return fromArch(userArch, \"User requested\");\n        }\n\n        Pattern osArch = Pattern.compile(\"os\\\\.arch\\\\s*=\\\\s*(\\\\w+)\");\n        Pattern amd64 = Pattern.compile(\"\\\\W(amd64|x86_64|x64)(\\\\W|$)\");\n        Pattern aarch64 = Pattern.compile(\"\\\\Waarch64(\\\\W|$)\");","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/disassembler/MachCode.java#L93-L129","documentation":"MachCode.fromArch maps an architecture name string to a Disassembler and throws this formatted IllegalArgumentException for any string other than x86_64/amd64/x64 or aarch64. The message intentionally embeds a second context string (typically where the arch name came from), so the full text tells you both the unrecognized value and its provenance. Only the two hsdis-backed ISAs are constructible.","triggerScenarios":"Calling MachCode.initDisassembler / fromArch with userArch set to an unsupported value (e.g. \"riscv\", \"ppc64\", empty-but-nonnull), or heuristic probing passing through an arch string parsed from an input file that is not one of the recognized spellings.","commonSituations":"Users passing a bad --arch flag to a disassembler CLI built on MachCode, or processing hs_err/.jtr files whose architecture line names an ISA GraalVM's hsdis does not cover.","solutions":["Pass one of the recognized spellings: x86_64, amd64, x64, or aarch64.","If arch is optional for your flow, pass null so MachCode falls back to heuristics/os.arch instead of an invalid literal.","Normalize user input (trim, lowercase, map 'arm64'->'aarch64') before handing it to fromArch.","For genuinely unsupported ISAs, use a different disassembler backend; this path cannot serve them."],"exampleFix":"// before\nDisassembler d = MachCode.initDisassembler(f, input, log, \"arm\"); // throws\n// after\nString arch = normalize(userArch); // maps arm64->aarch64, null stays null\nDisassembler d = MachCode.initDisassembler(f, input, log, arch);","handlingStrategy":"validation","validationCode":"static String normalizeArch(String a) {\n    if (a == null) return null;\n    return switch (a.trim().toLowerCase()) {\n        case \"amd64\", \"x86_64\", \"x64\" -> \"amd64\";\n        case \"aarch64\", \"arm64\" -> \"aarch64\";\n        default -> throw new IllegalArgumentException(\"unsupported arch: \" + a);\n    };\n}","typeGuard":null,"tryCatchPattern":"try { MachCode.initDisassembler(name, input, log, userArch); } catch (IllegalArgumentException e) { /* show supported values amd64/x64/aarch64 to the user */ }","preventionTips":["Normalize user-supplied arch strings before passing them in.","Pass null instead of an empty string when no override is wanted.","Recognized spellings are exactly x86_64, amd64, x64, aarch64."],"tags":["graalvm","disassembler","machcode","validation"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}