{"record":{"id":"c4efe781078c83fc","repo":"oracle/graal","slug":"s-is-not-a-valid-option-for-s-valid-values-ar-c4efe7","errorCode":null,"errorMessage":"\"%s\" is not a valid option for %s. Valid values are %s","messagePattern":"\"(.+?)\" is not a valid option for (.+?)\\. Valid values are (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"compiler/src/jdk.graal.compiler.options/src/jdk/graal/compiler/options/EnumOptionKey.java","lineNumber":53,"sourceCode":"        super(value);\n        if (value == null) {\n            throw new IllegalArgumentException(\"Value must not be null\");\n        }\n        this.enumClass = value.getDeclaringClass();\n    }\n\n    /**\n     * @return the set of possible values for this option.\n     */\n    public EnumSet<T> getAllValues() {\n        return EnumSet.allOf(enumClass);\n    }\n\n    public Object valueOf(String name) {\n        try {\n            return Enum.valueOf(enumClass, name);\n        } catch (IllegalArgumentException e) {\n            throw new IllegalArgumentException(\"\\\"\" + name + \"\\\" is not a valid option for \" + getName() + \". Valid values are \" + getAllValues());\n        }\n    }\n\n    @Override\n    protected void onValueUpdate(EconomicMap<OptionKey<?>, Object> values, T oldValue, T newValue) {\n        assert enumClass.isInstance(newValue) : newValue + \" is not a valid value for \" + getName();\n    }\n}\n","sourceCodeStart":35,"sourceCodeEnd":62,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/compiler/src/jdk.graal.compiler.options/src/jdk/graal/compiler/options/EnumOptionKey.java#L35-L62","documentation":"EnumOptionKey.valueOf delegates to Enum.valueOf(enumClass, name); an unknown constant throws IllegalArgumentException quoting the bad value, the option name, and EnumSet.allOf(enumClass) as the valid set. This is the standard parse-time check every single-valued Graal enum option performs when a -D option string is converted to its enum value.","triggerScenarios":"Setting a Graal enum option to a name that is not one of its constants: case mismatch (e.g. 'inline' vs 'Inline'), renamed constant across versions, or passing a boolean/other-typed value to an enum option.","commonSituations":"Command-line or .graal-compiler-config typos; documentation from a different GraalVM version; scripts built against older option sets after an upgrade.","solutions":["Use one of the constants listed in the message's 'Valid values are' output, with exact casing.","After upgrading GraalVM, re-check the option's enum via the options help/dump for renames.","Lint option values in build scripts against the enum values before running.","Prefer symbolic constants over hand-typed strings where the API allows setting the enum directly."],"exampleFix":"# before\n-Dgraal.OptimizationLevel=aggressive\n# after (valid constant from the message)\n-Dgraal.OptimizationLevel=Aggressive","handlingStrategy":"validation","validationCode":"// Check the value parses before launching with -D\ntry {\n    Enum.valueOf(MyOptionEnum.class, value);\n} catch (IllegalArgumentException e) {\n    throw new IllegalArgumentException(\"Invalid value; valid: \" + EnumSet.allOf(MyOptionEnum.class));\n}","typeGuard":null,"tryCatchPattern":"try {\n    EnumOptionKey k = (EnumOptionKey) key;\n    k.valueOf(value);\n} catch (IllegalArgumentException e) {\n    // message shows the valid set; correct the -D flag and restart\n}","preventionTips":["Match enum constant casing exactly","Verify option value sets per GraalVM version in a smoke test","Prefer API-set enum values over string flags when available"],"tags":["graal","options","enum","configuration","validation"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}