oracle/graal · error · JVMCIError

Unexpected OS name: %s

Error message

Unexpected OS name: %s

What it means

JVMCIError thrown by Platform while normalizing the os.name system property into an internal OS identifier. It recognizes Linux, SunOS, Mac OS X (mapped to solaris/darwin) and any name starting with 'Windows'; anything else means Graal does not know how to classify the host operating system and refuses to continue.

Source

Thrown at compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/Platform.java:78

     */
    private static String getCurrentOSName() {
        String value = getSavedProperty("os.name");
        switch (value) {
            case "Linux":
                value = "linux";
                break;
            case "SunOS":
                value = "solaris";
                break;
            case "Mac OS X":
                value = "darwin";
                break;
            default:
                // Windows names contain the OS version.
                if (value.startsWith("Windows")) {
                    value = "windows";
                } else {
                    throw new JVMCIError("Unexpected OS name: " + value);
                }
        }
        return value;
    }

    /**
     * Returns the name of the host architecture.
     */
    private static String getCurrentArchName() {
        String arch = getSavedProperty("os.arch");
        if (arch.equals("x86_64")) {
            arch = "amd64";
        }
        return arch;
    }
}

View on GitHub (pinned to a66e9ccd1d)

Solutions

  1. Run on a supported OS (Linux, macOS, Windows).
  2. Remove any -Dos.name=... override that corrupts the real value.
  3. If porting, extend the switch in Platform.java to map your os.name to an internal identifier.

Example fix

# before
java -Dos.name=MyOS -XX:+UseJVMCICompiler ...

# after
java -XX:+UseJVMCICompiler ...
Defensive patterns

Strategy: validation

Validate before calling

String os = System.getProperty("os.name", "");
boolean supported = os.equals("Linux") || os.equals("SunOS") || os.equals("Mac OS X") || os.startsWith("Windows");
if (!supported) {
    throw new IllegalStateException("Unsupported os.name for Graal: " + os);
}

Prevention

When it happens

Trigger: Executing Graal on a JVM whose os.name property reports something other than Linux/SunOS/Mac OS X/Windows*, e.g. an exotic or sandboxed JVM, a JVM with os.name overridden via -Dos.name=..., or an unsupported OS port.

Common situations: Tests that force -Dos.name for simulation and then accidentally trigger Graal compilation; running on a niche Unix (AIX, FreeBSD) where os.name is not in the switch; JVMCI code paths reaching Platform on an unported platform.

Related errors


AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14). Data as JSON: /api/errors/e0a96f8e819f9428. Report an issue: GitHub.