{"record":{"id":"d9df2e5d1351a765","repo":"oracle/graal","slug":"could-not-find-option-s-alternates-option-print","errorCode":null,"errorMessage":"Could not find option %s (alternates: Option PrintGraphFile has been removed - use PrintGraph=File instead; %nDid you mean one of the following?%n    %s=<value>)","messagePattern":"Could not find option (.+?) \\(alternates: Option PrintGraphFile has been removed - use PrintGraph=File instead; %nDid you mean one of the following\\?%n    (.+?)=<value>\\)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"compiler/src/jdk.graal.compiler.options/src/jdk/graal/compiler/options/OptionsParser.java","lineNumber":211,"sourceCode":"     */\n    public static void parseOption(String name, Object uncheckedValue, EconomicMap<OptionKey<?>, Object> values, Iterable<OptionDescriptors> loader) {\n\n        OptionDescriptor desc = lookup(loader, name);\n        if (desc == null) {\n            Formatter msg = new Formatter();\n            if (name.equals(\"PrintGraphFile\")) {\n                msg.format(\"Option PrintGraphFile has been removed - use PrintGraph=File instead\");\n            } else {\n                List<OptionDescriptor> matches = fuzzyMatch(loader, name);\n                msg.format(\"Could not find option %s\", name);\n                if (!matches.isEmpty()) {\n                    msg.format(\"%nDid you mean one of the following?\");\n                    for (OptionDescriptor match : matches) {\n                        msg.format(\"%n    %s=<value>\", match.getName());\n                    }\n                }\n            }\n            throw new IllegalArgumentException(msg.toString());\n        }\n\n        Object value = parseOptionValue(desc, uncheckedValue);\n\n        desc.getOptionKey().update(values, value);\n    }\n\n    /**\n     * Parses a given option value with a known descriptor.\n     */\n    public static Object parseOptionValue(OptionDescriptor desc, Object uncheckedValue) {\n        Class<?> optionType = desc.getOptionValueType();\n        Object value;\n        if (!(uncheckedValue instanceof String valueString)) {\n            if (optionType != uncheckedValue.getClass()) {\n                String type = optionType.getSimpleName();\n                throw new IllegalArgumentException(type + \" option '\" + desc.getName() + \"' must have \" + type + \" value, not \" + uncheckedValue.getClass() + \" [toString: \" + uncheckedValue + \"]\");\n            }","sourceCodeStart":193,"sourceCodeEnd":229,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/compiler/src/jdk.graal.compiler.options/src/jdk/graal/compiler/options/OptionsParser.java#L193-L229","documentation":"Thrown by OptionsParser.parseOptions when an option name is not found among the OptionDescriptors supplied by the loader. Before failing it runs fuzzyMatch to suggest close names, and it special-cases the removed 'PrintGraphFile' option to point at its replacement 'PrintGraph=File'. This is the standard 'unknown Graal option' error developers see with -Dgraal.* flags.","triggerScenarios":"Calling parseOptions with e.g. 'PrintGraphFile=true' (removed option), or a typo like 'PrintGrahp=false', or an option that exists in a different Graal build/suite than the one whose OptionDescriptor loader is passed in. The lookup is scoped to the descriptors the loader exposes, so a valid option can still fail if the loader lacks it.","commonSituations":"Upgrading GraalVM/JDK where an option was renamed or removed (PrintGraphFile is the canonical case); copying -Dgraal flags from documentation for a different Graal version; using an option that only exists in libgraal vs. compiler-only configurations; typos in long option names in launcher scripts.","solutions":["Read the suggestions in the message ('Did you mean one of the following?') and switch to the suggested exact name.","If the option is PrintGraphFile, replace it with PrintGraph=File as the message instructs.","Verify the option exists in your Graal version: check the options table via mx options or the GraalVM docs for the exact release.","Ensure the right OptionDescriptor loader (suite/classpath) is in scope when parsing programmatically."],"exampleFix":"// before\n-Dgraal.PrintGraphFile=true\n\n// after\n-Dgraal.PrintGraph=File","handlingStrategy":"validation","validationCode":"boolean optionExists(OptionDescriptorLoader loader, String name) {\n    return lookupOption(loader, name) != null;\n}\n\nString name = setting.substring(0, setting.indexOf('='));\nif (!optionExists(loader, name)) {\n    throw new ConfigException(\"Unknown Graal option '\" + name + \"' for this build\");\n}\nOptionsParser.parseOptions(...);","typeGuard":null,"tryCatchPattern":"try {\n    OptionsParser.parseOptions(settings, values, loader);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Could not find option\") || e.getMessage().contains(\"has been removed\")) {\n        log.warn(\"Skipping unknown Graal option: {}\", e.getMessage());\n        return; // or collect and report\n    }\n    throw e;\n}","preventionTips":["Pin the GraalVM version in CI so option sets match documentation.","Validate -Dgraal.* flags in a smoke-test JVM startup step before deployment.","When upgrading, diff the option list (mx options) between old and new versions."],"tags":["graalvm","options","unknown-option","configuration"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}