elastic/elasticsearch · error · IllegalArgumentException

unknown architecture [${architecture}] for jdk [${name}], mu

Error message

unknown architecture [${architecture}] for jdk [${name}], must be one of ${ALLOWED_ARCHITECTURES}

What it means

Thrown by Jdk.setArchitecture when the architecture string is not in ALLOWED_ARCHITECTURES (aarch64, x64). The architecture becomes the classifier in the dependency coordinate and is checked again for the zulu/JDK8/aarch64-only path, so an unrecognized value cannot be downloaded.

Source

Thrown at build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/Jdk.java:110

        return platform.get();
    }

    public void setPlatform(String platform) {
        if (ALLOWED_PLATFORMS.contains(platform) == false) {
            throw new IllegalArgumentException(
                "unknown platform [" + platform + "] for jdk [" + name + "], must be one of " + ALLOWED_PLATFORMS
            );
        }
        this.platform.set(platform);
    }

    public String getArchitecture() {
        return architecture.get();
    }

    public void setArchitecture(final String architecture) {
        if (ALLOWED_ARCHITECTURES.contains(architecture) == false) {
            throw new IllegalArgumentException(
                "unknown architecture [" + architecture + "] for jdk [" + name + "], must be one of " + ALLOWED_ARCHITECTURES
            );
        }
        this.architecture.set(architecture);
    }

    public String getDistributionVersion() {
        return distributionVersion.getOrNull();
    }

    public void setDistributionVersion(String distributionVersion) {
        this.distributionVersion.set(distributionVersion);
    }

    public String getBaseVersion() {
        return baseVersion;
    }

View on GitHub (pinned to db6a809a66)

Solutions

  1. Use 'x64' for Intel/AMD 64-bit; use 'aarch64' for ARM 64-bit (including Apple Silicon).
  2. Do not use 'amd64', 'x86_64', or 'arm64' — they are not in the allowlist.
  3. Verify case — values are lowercase and case-sensitive.

Example fix

// before
jdks { j { architecture = 'amd64'; } }
// after
jdks { j { architecture = 'x64'; } }
Defensive patterns

Strategy: validation

Validate before calling

import java.util.List;
final List<String> ALLOWED_ARCHITECTURES = List.of("aarch64", "x64");
void setJdkArchitecture(String architecture) {
    if (!ALLOWED_ARCHITECTURES.contains(architecture)) {
        throw new IllegalArgumentException(
            "architecture must be one of " + ALLOWED_ARCHITECTURES + ", got: " + architecture);
    }
    // ... proceed
}

Prevention

When it happens

Trigger: Jdk.setArchitecture(architecture) is called with a value other than 'aarch64' or 'x64'.

Common situations: Using 'amd64' or 'x86_64' instead of 'x64'; 'arm64' instead of 'aarch64'; 'i386' or 'x86' (not supported at all); 'aarch64-linux' (mixing platform into architecture); case mismatch.

Related errors


AI-assisted analysis of elastic/elasticsearch@db6a809a66 (2026-08-12). Data as JSON: /api/errors/b795137f020e1baa. Report an issue: GitHub.