{"record":{"id":"c74e5c902ffb17f7","repo":"github/copilot-sdk","slug":"unsupported-os-name-osname","errorCode":null,"errorMessage":"Unsupported os.name: + osName","messagePattern":"Unsupported os\\.name: \\+ osName","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"java/sdk/src/main/java/com/github/copilot/ffi/PlatformDetector.java","lineNumber":116,"sourceCode":"     *\n     * @return platform classifier string\n     */\n    public static String detectClassifier() {\n        return detectClassifier(detectOs(), detectArch(), detectLinuxLibc());\n    }\n\n    static String detectOs(String osName) {\n        String normalized = osName.toLowerCase(Locale.ROOT);\n        if (normalized.contains(\"mac\") || normalized.contains(\"darwin\")) {\n            return \"darwin\";\n        }\n        if (normalized.contains(\"win\")) {\n            return \"win32\";\n        }\n        if (normalized.contains(\"linux\")) {\n            return \"linux\";\n        }\n        throw new IllegalStateException(\"Unsupported os.name: \" + osName);\n    }\n\n    static String detectArch(String osArch) {\n        String normalized = osArch.toLowerCase(Locale.ROOT).replace('-', '_');\n        if (normalized.equals(\"amd64\") || normalized.equals(\"x86_64\") || normalized.equals(\"x64\")) {\n            return \"x64\";\n        }\n        if (normalized.equals(\"aarch64\") || normalized.equals(\"arm64\")) {\n            return \"arm64\";\n        }\n        throw new IllegalStateException(\"Unsupported os.arch: \" + osArch);\n    }\n\n    static LinuxLibc detectLinuxLibc(Path executablePath) {\n        try {\n            return detectLinuxLibc(readPrefix(executablePath, ELF_HEADER_PROBE_BYTES));\n        } catch (IOException ex) {\n            return LinuxLibc.UNKNOWN;","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/java/sdk/src/main/java/com/github/copilot/ffi/PlatformDetector.java#L98-L134","documentation":"PlatformDetector.detectOs maps the JVM's os.name system property to a platform classifier ('win32', 'linux', or macOS). If the normalized os.name contains none of the recognized substrings (mac/win/linux), it throws IllegalStateException. The library only ships native runtimes for these platforms, so an unknown OS cannot be served.","triggerScenarios":"Any load path that triggers platform detection on a JVM whose os.name is exotic — e.g. Solaris, AIX, FreeBSD, or a JVM reporting a custom/blank os.name. Note the message text itself literally contains '+ osName' due to a formatting typo in the source.","commonSituations":"Running on FreeBSD/OpenBSD with the Linux compatibility layer not fully reporting 'linux'; exotic/embedded JVMs (e.g. some J2ME-like or custom builds) with unusual os.name values; cross-compilation/test environments setting os.name deliberately.","solutions":["Run the library on a supported OS (macOS, Windows, Linux) or a JVM reporting a standard os.name.","Override the os.name system property (-Dos.name=Linux) when running on a compatible platform with a nonstandard report — e.g. FreeBSD Linux emulation.","Check for code/tests that set os.name to a fake value before the loader initializes.","File/await upstream support for the unsupported OS classifier."],"exampleFix":"// before (FreeBSD, os.name=FreeBSD)\njava -jar app.jar\n// after (Linux emulation layer)\njava -Dos.name=Linux -jar app.jar","handlingStrategy":"validation","validationCode":"// Java: check OS support before initializing the loader\nString osName = System.getProperty(\"os.name\", \"\").toLowerCase(Locale.ROOT);\nboolean supported = osName.contains(\"mac\") || osName.contains(\"darwin\") || osName.contains(\"win\") || osName.contains(\"linux\");\nif (!supported) throw new IllegalStateException(\"Unsupported os.name: \" + osName + \"; run on macOS/Windows/Linux\");","typeGuard":null,"tryCatchPattern":"try { loader.loadRuntime(); } catch (IllegalStateException e) { if (e.getMessage().startsWith(\"Unsupported os.name\")) { // fail fast with a supported-platforms message, or retry with -Dos.name override } else throw e; }","preventionTips":["Document supported OSes (macOS/Windows/Linux) in deployment requirements","Skip native-dependent tests on unsupported platforms in CI matrices","Be cautious overriding os.name; only use it for genuinely compatible platforms"],"tags":["platform","unsupported-os","java","initialization"],"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"}