oracle/graal · error · IllegalArgumentException

Unknown argument: %s

Error message

Unknown argument: %s

What it means

IllegalArgumentException thrown from the main() of the JVMCIVersionCheck command-line tool when an unrecognized argument is passed. The tool accepts exactly two flags, --as-tag and --min-version; everything else is rejected so typos fail fast instead of silently changing behavior.

Source

Thrown at compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/JVMCIVersionCheck.java:496

    /**
     * Command line interface for performing the check.
     */
    public static void main(String[] args) {
        Properties sprops = System.getProperties();
        Map<String, String> props = new LinkedHashMap<>(sprops.size());
        for (String name : sprops.stringPropertyNames()) {
            props.put(name, sprops.getProperty(name));
        }
        PrintFormat format = PrintFormat.TUPLE;
        boolean minVersion = false;
        for (String arg : args) {
            if (arg.equals("--as-tag")) {
                format = PrintFormat.AS_TAG;
            } else if (arg.equals("--min-version")) {
                minVersion = true;
            } else {
                throw new IllegalArgumentException("Unknown argument: " + arg);
            }
        }
        if (minVersion) {
            String javaSpecVersion = props.get(JAVA_SPECIFICATION_VERSION_PROPERTY);
            Version v = getMinVersion(props, JVMCI_MIN_VERSIONS);
            if (v == null) {
                System.out.printf("No minimum JVMCI version specified for JDK version %s.%n", javaSpecVersion);
            } else {
                printVersion(v, format, props);
            }
        } else {
            check(props, true, format);
        }
    }
}

View on GitHub (pinned to a66e9ccd1d)

Solutions

  1. Remove or correct the argument; valid flags are only --as-tag and --min-version.
  2. Run with no arguments to perform the default version check.
  3. Check the tool's source/Javadoc for the supported flag list for your compiler version.

Example fix

# before
mx JVMCIVersionCheck --format=tuple

# after
mx JVMCIVersionCheck --as-tag
Defensive patterns

Strategy: validation

Validate before calling

Set<String> ALLOWED = Set.of("--as-tag", "min-version");
for (String arg : args) {
    if (!ALLOWED.contains(arg)) {
        throw new IllegalArgumentException("Unsupported flag, use --as-tag or --min-version: " + arg);
    }
}

Prevention

When it happens

Trigger: Invoking the class as a CLI tool (e.g. mx JVMCIVersionCheck or java ... JVMCIVersionCheck) with any argument other than --as-tag or --min-version, such as --help, --format=tuple, or a misspelled --min-verison.

Common situations: Scripts or mx suite configs that call the version-check tool and pass unsupported flags after a GraalVM update that changed the flag set; developers trying --help out of habit.

Related errors


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