github/copilot-sdk · error · IllegalStateException
Unsupported platform tuple: os= + os + , arch= + arch + …
Error message
Unsupported platform tuple: os= + os + , arch= + arch + , libc= + classifierLibc
What it means
detectClassifier maps an (os, arch, libc) tuple to a supported artifact classifier string via CLASSIFIER_BY_KEY. If the lookup returns null or the classifier is not in SUPPORTED_CLASSIFIERS, the JVM has no native library for this platform, so an IllegalStateException is thrown. It fails fast instead of returning a classifier the runtime cannot satisfy.
Solutions
- Check the returned error's os/arch/libc values against the platform matrix in CLASSIFIER_BY_KEY and move to a supported platform (typical combos: linux/glibc/x86_64, linux/glibc/aarch64, darwin/x86_64, darwin/aarch64, windows/x86_64).
- On Alpine/musl, install and use the glibc-compatible build or upgrade the SDK to a version that registers musl classifiers.
- Verify os and arch strings are lowercase and canonical (x86_64 vs amd64, macos vs darwin) before calling detectClassifier.
- Upgrade the SDK to a release that adds support for this platform tuple.
- If the platform should be supported, file a bug including the exact tuple from the message.
Example fix
// before
String classifier = PlatformDetector.detectClassifier("alpine3.18", arch, LinuxLibc.MUSL);
// after
// normalize inputs and verify support first
if (!PlatformDetector.supportedClassifiers().contains("linux-x86_64")) {
throw new IllegalStateException("Deploy on a supported platform");
}
String classifier = PlatformDetector.detectClassifier("linux", "x86_64", LinuxLibc.GLIBC); Defensive patterns
Strategy: validation
Validate before calling
Set<String> supported = PlatformDetector.supportedClassifiers();
String guess = os + "-" + arch;
if (!supported.contains(guess)) {
throw new UnsupportedOperationException("Unsupported platform: " + guess + "; supported=" + supported);
} Type guard
static boolean isSupportedPlatform(String os, String arch) {
return PlatformDetector.supportedClassifiers().contains(os + "-" + arch);
} Try / catch
String classifier;
try {
classifier = PlatformDetector.detectClassifier(os, arch, libc);
} catch (IllegalStateException e) {
throw new UnsupportedOperationException(
"This SDK build does not support " + os + "/" + arch + ": " + e.getMessage(), e);
} Prevention
- Call supportedClassifiers() once at startup and fail early with a clear message before any native loading.
- Normalize os/arch strings (lowercase, canonical arch names like x86_64/aarch64) before detection.
- On Alpine/musl, verify the SDK version registers musl classifiers or use a glibc-based image.
- Pin supported platforms in CI and test startup on each target OS/arch matrix.
When it happens
Trigger: Calling detectClassifier (directly or via detectClassifier/interpreter) with an os/arch combination not in the map (e.g. os=windows, arch=arm64; os=freebsd; os=linux, arch=riscv64), or os=linux with a LinuxLibc value (e.g. MUSL) that has no registered classifier, or a classifier present in the map but removed from SUPPORTED_CLASSIFIERS.
Common situations: Running the SDK on an unusual or newly-released architecture; running Linux with musl libc (Alpine) when only glibc classifiers are registered; a typo or casing mismatch in os/arch strings passed programmatically; upgrading to a Java version/JDK build on a platform the SDK version predates.
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
- Unsupported os.name: + osName
- Unsupported os.arch: + osArch
- WebSocket response bridge is not attached
- An in-process FFI runtime library is already loaded from
- FFI runtime library not found at
AI-assisted analysis of github/copilot-sdk@cd8cf15dc3 (2026-09-09).
Data as JSON: /api/errors/b337214a34386713.
Report an issue: GitHub.
Appendix: source
Thrown at java/sdk/src/main/java/com/github/copilot/ffi/PlatformDetector.java:153
}
}
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;
}
return LinuxLibc.UNKNOWN;
}
static String detectClassifier(String os, String arch, LinuxLibc linuxLibc) {
LinuxLibc classifierLibc = "linux".equals(os) ? linuxLibc : LinuxLibc.UNKNOWN;
String classifier = CLASSIFIER_BY_KEY.get(new ClassifierKey(os, arch, classifierLibc));
if (classifier == null || !SUPPORTED_CLASSIFIERS.contains(classifier)) {
throw new IllegalStateException(
"Unsupported platform tuple: os=" + os + ", arch=" + arch + ", libc=" + classifierLibc);
}
return classifier;
}
static Set<String> supportedClassifiers() {
return SUPPORTED_CLASSIFIERS;
}
private static String readElfPtInterp(byte[] probe) throws IOException {
int size = probe.length;
if (size < 64) {
throw new IOException("ELF probe too small: " + size + " bytes");
}
if ((probe[0] & 0xFF) != ELF_MAGIC_0 || (probe[1] & 0xFF) != ELF_MAGIC_1 || (probe[2] & 0xFF) != ELF_MAGIC_2
|| (probe[3] & 0xFF) != ELF_MAGIC_3) {
throw new IOException("Not an ELF executable");
}View on GitHub (pinned to cd8cf15dc3)