{"record":{"id":"b3892dda546ba80d","repo":"elastic/elasticsearch","slug":"architecture","errorCode":null,"errorMessage":"Architecture {}","messagePattern":"Architecture (.+?)","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/toolchain/AbstractCustomJavaToolchainResolver.java","lineNumber":37,"sourceCode":"    static String toOsString(OperatingSystem operatingSystem) {\n        return toOsString(operatingSystem, null);\n    }\n\n    static String toOsString(OperatingSystem operatingSystem, JvmVendorSpec v) {\n        return switch (operatingSystem) {\n            case MAC_OS -> (v == null || v.equals(JvmVendorSpec.ADOPTIUM) == false) ? \"macos\" : \"mac\";\n            case LINUX -> \"linux\";\n            case WINDOWS -> \"windows\";\n            default -> throw new UnsupportedOperationException(\"Operating system \" + operatingSystem);\n        };\n    }\n\n    static String toArchString(Architecture architecture) {\n        return switch (architecture) {\n            case X86_64 -> \"x64\";\n            case AARCH64 -> \"aarch64\";\n            case X86 -> \"x86\";\n            default -> throw new UnsupportedOperationException(\"Architecture \" + architecture);\n        };\n    }\n\n    protected static boolean anyVendorOr(JvmVendorSpec givenVendor, JvmVendorSpec expectedVendor) {\n        return givenVendor.matches(\"any\") || givenVendor.equals(expectedVendor);\n    }\n}\n","sourceCodeStart":19,"sourceCodeEnd":45,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/toolchain/AbstractCustomJavaToolchainResolver.java#L19-L45","documentation":"UnsupportedOperationException from the toolchain resolver's architecture-name mapping. toArchString() handles only X86_64, AARCH64, and X86; any other Architecture falls to default.","triggerScenarios":"Gradle reports an Architecture enum value such as ARM64 (non-AARCH64 naming) or a future constant (e.g. RISCV64, LOONGARCH64) when resolving a custom JDK download.","commonSituations":"Building on emerging architectures not yet enumerated; Gradle version mismatch introducing/renaming an Architecture constant; a test injecting an unsupported architecture.","solutions":["Verify the host CPU maps to X86_64, AARCH64, or X86 in Gradle's detection.","Add an explicit case branch with the download catalogue's arch token if a new architecture must be supported.","Align the Gradle version with the resolver's known Architecture set."],"exampleFix":"// before\ncase X86 -> \"x86\";\ndefault -> throw new UnsupportedOperationException(\"Architecture \" + architecture);\n\n// after\ncase X86 -> \"x86\";\ncase RISCV64 -> \"riscv64\";\ndefault -> throw new UnsupportedOperationException(\"Architecture \" + architecture);","handlingStrategy":"validation","validationCode":"Set<Architecture> supported = EnumSet.of(Architecture.X86_64, Architecture.AARCH64, Architecture.X86);\nif (!supported.contains(architecture)) {\n    throw new IllegalStateException(\"Unsupported architecture for custom toolchain: \" + architecture);\n}","typeGuard":"static boolean isArchSupported(Architecture a) {\n    return a == Architecture.X86_64 || a == Architecture.AARCH64 || a == Architecture.X86;\n}","tryCatchPattern":null,"preventionTips":["Build only on supported architectures.","Extend the resolver when adopting new hardware before running the build there.","Keep the Gradle version aligned with the resolver's known Architecture set."],"tags":["gradle","toolchain","jdk","build-tooling","platform"],"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-12T06:17:24.410Z"}