{"record":{"id":"b337214a34386713","repo":"github/copilot-sdk","slug":"unsupported-platform-tuple-os-os-arch-a","errorCode":null,"errorMessage":"Unsupported platform tuple: os= + os + , arch= + arch + , libc= + classifierLibc","messagePattern":"Unsupported platform tuple: os= \\+ os \\+ , arch= \\+ arch \\+ , libc= \\+ classifierLibc","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"java/sdk/src/main/java/com/github/copilot/ffi/PlatformDetector.java","lineNumber":153,"sourceCode":"        }\n    }\n\n    static LinuxLibc detectLinuxLibc(byte[] elfPrefix) throws IOException {\n        String interpreter = readElfPtInterp(elfPrefix);\n        if (interpreter.contains(\"/ld-musl-\")) {\n            return LinuxLibc.MUSL;\n        }\n        if (interpreter.contains(\"/ld-linux-\")) {\n            return LinuxLibc.GLIBC;\n        }\n        return LinuxLibc.UNKNOWN;\n    }\n\n    static String detectClassifier(String os, String arch, LinuxLibc linuxLibc) {\n        LinuxLibc classifierLibc = \"linux\".equals(os) ? linuxLibc : LinuxLibc.UNKNOWN;\n        String classifier = CLASSIFIER_BY_KEY.get(new ClassifierKey(os, arch, classifierLibc));\n        if (classifier == null || !SUPPORTED_CLASSIFIERS.contains(classifier)) {\n            throw new IllegalStateException(\n                    \"Unsupported platform tuple: os=\" + os + \", arch=\" + arch + \", libc=\" + classifierLibc);\n        }\n        return classifier;\n    }\n\n    static Set<String> supportedClassifiers() {\n        return SUPPORTED_CLASSIFIERS;\n    }\n\n    private static String readElfPtInterp(byte[] probe) throws IOException {\n        int size = probe.length;\n        if (size < 64) {\n            throw new IOException(\"ELF probe too small: \" + size + \" bytes\");\n        }\n        if ((probe[0] & 0xFF) != ELF_MAGIC_0 || (probe[1] & 0xFF) != ELF_MAGIC_1 || (probe[2] & 0xFF) != ELF_MAGIC_2\n                || (probe[3] & 0xFF) != ELF_MAGIC_3) {\n            throw new IOException(\"Not an ELF executable\");\n        }","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/java/sdk/src/main/java/com/github/copilot/ffi/PlatformDetector.java#L135-L171","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nString classifier = PlatformDetector.detectClassifier(\"alpine3.18\", arch, LinuxLibc.MUSL);\n// after\n// normalize inputs and verify support first\nif (!PlatformDetector.supportedClassifiers().contains(\"linux-x86_64\")) {\n    throw new IllegalStateException(\"Deploy on a supported platform\");\n}\nString classifier = PlatformDetector.detectClassifier(\"linux\", \"x86_64\", LinuxLibc.GLIBC);","handlingStrategy":"validation","validationCode":"Set<String> supported = PlatformDetector.supportedClassifiers();\nString guess = os + \"-\" + arch;\nif (!supported.contains(guess)) {\n    throw new UnsupportedOperationException(\"Unsupported platform: \" + guess + \"; supported=\" + supported);\n}","typeGuard":"static boolean isSupportedPlatform(String os, String arch) {\n    return PlatformDetector.supportedClassifiers().contains(os + \"-\" + arch);\n}","tryCatchPattern":"String classifier;\ntry {\n    classifier = PlatformDetector.detectClassifier(os, arch, libc);\n} catch (IllegalStateException e) {\n    throw new UnsupportedOperationException(\n        \"This SDK build does not support \" + os + \"/\" + arch + \": \" + e.getMessage(), e);\n}","preventionTips":["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."],"tags":["platform","native-library","initialization","java"],"backgroundTag":"unsupported-platform","analyzedSha":"cd8cf15dc3f9e762615790aaed0a771a0f392755","analyzedAt":"2026-09-09T18:32:31.973Z","contentChangedAt":"2026-09-09T18:32:31.973Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}