elastic/elasticsearch · critical · IllegalArgumentException
can not determine architecture from [${architecture}]
Error message
can not determine architecture from [${architecture}] What it means
Architecture.current maps the JVM's os.arch to either X64 (amd64/x86_64) or AARCH64 (aarch64). Any other architecture — ppc64le, s390x, riscv64, armv7l, or an empty/unknown value — falls through the switch default and throws IllegalArgumentException. This is hit early in build configuration when the distribution plugin resolves the host architecture.
Source
Thrown at build-tools/src/main/java/org/elasticsearch/gradle/Architecture.java:43
Architecture(String classifier, String dockerPlatform, String dockerClassifier, String javaClassifier) {
this.classifier = classifier;
this.dockerPlatform = dockerPlatform;
this.dockerClassifier = dockerClassifier;
this.javaClassifier = javaClassifier;
}
@Override
public String getName() {
return classifier;
}
public static Architecture current() {
final String architecture = System.getProperty("os.arch", "");
return switch (architecture) {
case "amd64", "x86_64" -> X64;
case "aarch64" -> AARCH64;
default -> throw new IllegalArgumentException("can not determine architecture from [" + architecture + "]");
};
}
/**
* Returns the architecture that matches the given Docker platform string (e.g. "linux/amd64").
*
* @param platform the Docker platform string from e.g. {@code docker buildx inspect}
* @return the matching architecture, or empty if unknown
*/
public static Optional<Architecture> fromDockerPlatform(String platform) {
if (platform == null || platform.isBlank()) {
return Optional.empty();
}
String trimmed = platform.trim();
for (Architecture a : values()) {
if (a.dockerPlatform.equals(trimmed)) {
return Optional.of(a);
}View on GitHub (pinned to db6a809a66)
Solutions
- Run on an amd64 or aarch64 host/JVM.
- If your arch is equivalent, force it: `-Dos.arch=x86_64` (only when genuinely compatible).
- Extend the switch in Architecture.current to map your os.arch and contribute the change.
- For distribution tasks, set the distribution's architecture explicitly via setArchitecture rather than relying on current().
Example fix
// before: build on ppc64le throws ./gradlew :distribution:archives:linux-tar:assemble // after: build under a compatible arch or override java -Dos.arch=x86_64 -jar gradle-wrapper.jar :distribution:archives:linux-tar:assemble # only if truly compatible
Defensive patterns
Strategy: validation
Validate before calling
static Optional<Architecture> safeCurrent() {
String arch = System.getProperty("os.arch", "");
return switch (arch) {
case "amd64", "x86_64" -> Optional.of(Architecture.X64);
case "aarch64" -> Optional.of(Architecture.AARCH64);
default -> Optional.empty();
};
}
// then: safeCurrent().orElseThrow(() -> new IllegalStateException("Unsupported os.arch: " + System.getProperty("os.arch"))) Type guard
static boolean isSupportedArch(String osArch) {
return "amd64".equals(osArch) || "x86_64".equals(osArch) || "aarch64".equals(osArch);
} Prevention
- Run Elasticsearch builds on amd64 or aarch64 hosts.
- If your arch is binary-compatible, override -Dos.arch explicitly and document why.
- Set the distribution's architecture via setArchitecture rather than relying on current().
When it happens
Trigger: Running the Elasticsearch Gradle build on a JVM whose os.arch is not amd64, x86_64, or aarch64. Most common on POWER, s390x, RISC-V, or 32-bit ARM hosts, or under a misreported cross-arch emulation.
Common situations: Building on ppc64le/s390x CI agents; RISC-V or armhf development boards; a JVM reporting an unexpected os.arch string; cross-compilation scenarios that did not override the architecture property.
Related errors
- unknown platform [${platform}] for jdk [${name}], must be on
- unknown architecture [${architecture}] for jdk [${name}], mu
- Elasticsearch version is missing from properties.
- Expected elasticsearch version to be numbers only of the for
- Invalid qualifier: ${qualifier}
AI-assisted analysis of elastic/elasticsearch@db6a809a66 (2026-08-12).
Data as JSON: /api/errors/5d2bbd9b5c797e5b.
Report an issue: GitHub.