{"record":{"id":"5347fd1df8f1c385","repo":"oracle/graal","slug":"could-not-find-option-s","errorCode":null,"errorMessage":"Could not find option %s","messagePattern":"Could not find option (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"compiler/src/jdk.graal.compiler.libgraal/src/jdk/graal/compiler/libgraal/LibGraalSupportImpl.java","lineNumber":193,"sourceCode":"    /**\n     * The set of libgraal options seen on the command line.\n     */\n    static EconomicSet<String> explicitOptions = EconomicSet.create();\n\n    @Override\n    public void notifyOptions(EconomicMap<String, String> settings) {\n        MapCursor<String, String> cursor = settings.getEntries();\n        while (cursor.advance()) {\n            String name = cursor.getKey();\n            String stringValue = cursor.getValue();\n            Object value;\n            if (name.startsWith(\"X\") && stringValue.isEmpty()) {\n                name = name.substring(1);\n                value = stringValue;\n            } else {\n                RuntimeOptions.Descriptor desc = RuntimeOptions.getDescriptor(name);\n                if (desc == null) {\n                    throw new IllegalArgumentException(\"Could not find option \" + name);\n                }\n                value = desc.convertValue(stringValue);\n                explicitOptions.add(name);\n            }\n            try {\n                RuntimeOptions.set(name, value);\n            } catch (RuntimeException ex) {\n                throw new IllegalArgumentException(ex);\n            }\n        }\n    }\n\n    @Override\n    public void printOptions(PrintStream out, String namePrefix) {\n        Comparator<RuntimeOptions.Descriptor> comparator = Comparator.comparing(RuntimeOptions.Descriptor::name);\n        RuntimeOptions.listDescriptors().stream().sorted(comparator).forEach(d -> {\n            String assign = explicitOptions.contains(d.name()) ? \":=\" : \"=\";\n            OptionValues.printHelp(out, namePrefix,","sourceCodeStart":175,"sourceCodeEnd":211,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/compiler/src/jdk.graal.compiler.libgraal/src/jdk/graal/compiler/libgraal/LibGraalSupportImpl.java#L175-L211","documentation":"LibGraalSupportImpl.notifyOptions forwards each entry of a settings map to RuntimeOptions. Every key that does not start with 'X' followed by an empty value must match a registered RuntimeOptions descriptor; otherwise it throws IllegalArgumentException('Could not find option ' + name). This is strict option-name validation before any value conversion happens.","triggerScenarios":"Calling the libgraal entry point with a settings/EconomicMap containing an option name that is not a registered libgraal RuntimeOption (typo, JVM-style '-XX:' flag name, or an option that only exists in the Java Graal compiler, not libgraal).","commonSituations":"Copying Java-mode Graal option names into native libgraal configuration; GraalVM version skew where an option was renamed or removed; passing boolean flags without the special 'X'+empty-value encoding.","solutions":["Check the exact spelling against the libgraal option registry for your GraalVM version (e.g. via the options dump/print command your build exposes).","Remove or gate options that only exist in the Java-hosted compiler.","If the option is boolean-style, use the 'X'-prefixed key with an empty string value, which notifyOptions treats as a flag.","Upgrade/downgrade the caller and libgraal image to matching versions so the option sets align."],"exampleFix":"// before\nsettings.put(\"NonExistentGraalOption\", \"true\");\n// after (registered name, or a flag via the X convention)\nsettings.put(\"XSomeBooleanBehavior\", \"\");","handlingStrategy":"validation","validationCode":"// Before notifyOptions: filter unknown keys\nMapCursor<String, String> c = settings.getEntries();\nwhile (c.advance()) {\n    String k = c.getKey();\n    boolean isFlag = k.startsWith(\"X\") && c.getValue().isEmpty();\n    if (!isFlag && RuntimeOptions.getDescriptor(k) == null) {\n        throw new IllegalArgumentException(\"Rejecting unknown option early: \" + k);\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    support.notifyOptions(settings);\n} catch (IllegalArgumentException e) {\n    // message names the offending option; strip or correct it and retry once\n    if (e.getMessage() != null && e.getMessage().startsWith(\"Could not find option\")) { /* drop key, re-run */ }\n}","preventionTips":["Validate option names against the libgraal registry before submitting settings","Keep caller and libgraal image versions in lockstep","Encode boolean flags with the X-prefix + empty value convention"],"tags":["libgraal","options","configuration","validation"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}