{"record":{"id":"fe3ac0823b381772","repo":"oracle/graal","slug":"s-is-not-a-valid-option-for-s-valid-values-ar","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/EnumMultiOptionKey.java","lineNumber":66,"sourceCode":"\n    /**\n     * Returns 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        EconomicSet<T> value = EconomicSet.create();\n        if (name.isEmpty()) {\n            return value;\n        }\n        String[] names = name.split(\",\");\n        for (String splitName : names) {\n            try {\n                value.add(Enum.valueOf(enumClass, splitName));\n            } catch (IllegalArgumentException e) {\n                throw new IllegalArgumentException(\"\\\"\" + splitName + \"\\\" is not a valid option for \" + getName() + \". Valid values are \" + getAllValues());\n            }\n        }\n        return value;\n    }\n}\n","sourceCodeStart":48,"sourceCodeEnd":72,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/compiler/src/jdk.graal.compiler.options/src/jdk/graal/compiler/options/EnumMultiOptionKey.java#L48-L72","documentation":"EnumMultiOptionKey parses a comma-separated option value into an EconomicSet of enum constants. Each split name is passed to Enum.valueOf; failure throws IllegalArgumentException with the quoted bad value, the option's name, and the full set of valid enum constants. This is the parse-time validation for multi-valued enum options like -Dgraal.SomeOption=A,B.","triggerScenarios":"Setting a multi-value enum option to a string containing a token that is not one of its enum constants — misspelling, wrong case (enum names are matched exactly), trailing comma producing an empty token after split in some cases, or a constant that exists only in another GraalVM version.","commonSituations":"Typos in -Dgraal.* flags on the command line or in mx/env files; upgrading GraalVM where an enum constant was renamed/removed; copy-pasting option values from documentation for a different version.","solutions":["Match the token exactly (case-sensitive) to one of the constants listed in the message's 'Valid values are' set.","Remove stale constants after a GraalVM upgrade by checking the current enum's values (the error message enumerates them all).","Validate the value in CI with a smoke run that parses options before deployment.","Watch for whitespace or trailing commas around tokens in the comma-separated list."],"exampleFix":"# before\n-Dgraal.GraalCompilerConfiguration=misspelled,native\n# after (exact enum constant names from the message)\n-Dgraal.GraalCompilerConfiguration=community,native","handlingStrategy":"validation","validationCode":"// Validate tokens against the enum before setting the option\nSet<String> valid = EnumSet.allOf(MyOptionEnum.class).stream().map(Enum::name).collect(Collectors.toSet());\nfor (String token : value.split(\",\")) {\n    if (!valid.contains(token)) throw new IllegalArgumentException(\"bad token: \" + token);\n}","typeGuard":null,"tryCatchPattern":"try {\n    optionKey.valueOf(value);\n} catch (IllegalArgumentException e) {\n    // message lists all valid values; pick the closest constant and re-run\n}","preventionTips":["Copy constant names exactly (case-sensitive) from the error's valid-values list","Re-check enum constants after GraalVM upgrades","Avoid whitespace/trailing commas in comma-separated values"],"tags":["graal","options","enum","configuration","validation"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}