github/copilot-sdk · error · IllegalStateException

Unsupported os.arch: + osArch

Error message

Unsupported os.arch: + osArch

What it means

PlatformDetector.detectArch maps the os.arch system property to 'x64' or 'arm64' (with '-' normalized to '_'). Any other architecture throws IllegalStateException because the library bundles native runtimes only for these two architectures. Like error 188, the message string contains a literal '+ osArch' typo instead of the interpolated value.

Solutions

  1. Run on an x64 or arm64 machine (or container image) — the only architectures with bundled natives.
  2. Use a 64-bit JVM on x86_64 hardware instead of a 32-bit (i386/i686) JVM.
  3. Switch container base images/CI runners to linux/amd64 or linux/arm64 platforms (e.g. docker run --platform linux/amd64).
  4. Request upstream support for additional architectures.

Example fix

// before (docker on s390x mainframe)
FROM ibmjava:8
// after
FROM eclipse-temurin:17 --platform=linux/amd64
Defensive patterns

Strategy: validation

Validate before calling

// Java: check architecture support before initializing the loader
String arch = System.getProperty("os.arch", "").toLowerCase(Locale.ROOT).replace('-', '_');
boolean supported = arch.equals("amd64") || arch.equals("x86_64") || arch.equals("x64") || arch.equals("aarch64") || arch.equals("arm64");
if (!supported) throw new IllegalStateException("Unsupported os.arch: " + arch + "; x64/arm64 only");

Try / catch

try { loader.loadRuntime(); } catch (IllegalStateException e) { if (e.getMessage().startsWith("Unsupported os.arch")) { // fail fast or re-run under an amd64/arm64 environment } else throw e; }

Prevention

When it happens

Trigger: Detection runs on a JVM reporting os.arch other than amd64/x86_64/x64/aarch64/arm64 — e.g. 'i386', 'ppc64le', 's390x', 'riscv64', or a blank/custom value from an embedded JVM.

Common situations: Deploying to POWER (ppc64le) or IBM Z (s390x) mainframe Linux; 32-bit x86 JVMs on x86_64 hosts; RISC-V development boards; Docker images using non-amd64/arm64 base images.

Understand the failure class

Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.

Related errors


AI-assisted analysis of github/copilot-sdk@cd8cf15dc3 (2026-09-09). Data as JSON: /api/errors/903bf04e16cd539d. Report an issue: GitHub.

Appendix: source

Thrown at java/sdk/src/main/java/com/github/copilot/ffi/PlatformDetector.java:127

        }
        if (normalized.contains("win")) {
            return "win32";
        }
        if (normalized.contains("linux")) {
            return "linux";
        }
        throw new IllegalStateException("Unsupported os.name: " + osName);
    }

    static String detectArch(String osArch) {
        String normalized = osArch.toLowerCase(Locale.ROOT).replace('-', '_');
        if (normalized.equals("amd64") || normalized.equals("x86_64") || normalized.equals("x64")) {
            return "x64";
        }
        if (normalized.equals("aarch64") || normalized.equals("arm64")) {
            return "arm64";
        }
        throw new IllegalStateException("Unsupported os.arch: " + osArch);
    }

    static LinuxLibc detectLinuxLibc(Path executablePath) {
        try {
            return detectLinuxLibc(readPrefix(executablePath, ELF_HEADER_PROBE_BYTES));
        } catch (IOException ex) {
            return LinuxLibc.UNKNOWN;
        }
    }

    static LinuxLibc detectLinuxLibc(byte[] elfPrefix) throws IOException {
        String interpreter = readElfPtInterp(elfPrefix);
        if (interpreter.contains("/ld-musl-")) {
            return LinuxLibc.MUSL;
        }
        if (interpreter.contains("/ld-linux-")) {
            return LinuxLibc.GLIBC;
        }

View on GitHub (pinned to cd8cf15dc3)