{"record":{"id":"ff78735639b55cf1","repo":"oracle/graal","slug":"option-name-must-follow-prefix-prefix","errorCode":null,"errorMessage":"Option name must follow '<prefix>' prefix","messagePattern":"Option name must follow '<prefix>' prefix","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/HotSpotGraalOptionValues.java","lineNumber":144,"sourceCode":"            }\n\n            if (!vmOptionSettings.isEmpty()) {\n                LibGraalSupport libgraal = LibGraalSupport.INSTANCE;\n                if (libgraal != null) {\n                    libgraal.notifyOptions(vmOptionSettings);\n                } else {\n                    System.err.printf(\"WARNING: Ignoring the following libgraal VM option(s) while executing jargraal: %s%n\", vmOptionSettings);\n                }\n            }\n            OptionsParser.parseOptions(compilerOptionSettings, compilerOptionValues, descriptors);\n            return compilerOptionValues;\n        }\n    }\n\n    private static String stripPrefix(String name, String prefix) {\n        String baseName = name.substring(prefix.length());\n        if (baseName.isEmpty()) {\n            throw new IllegalArgumentException(\"Option name must follow '\" + prefix + \"' prefix\");\n        }\n        return baseName;\n    }\n\n    private static OptionValues initializeOptions() {\n        EconomicMap<OptionKey<?>, Object> values = parseOptions();\n        OptionValues options = new OptionValues(values);\n        if (HotSpotGraalCompiler.Options.CrashAtThrowsOOME.getValue(options) && HotSpotGraalCompiler.Options.CrashAtIsFatal.getValue(options) != 0) {\n            throw new IllegalArgumentException(\"CrashAtThrowsOOME and CrashAtIsFatal cannot both be enabled\");\n        }\n        return options;\n    }\n\n    static void printProperties(OptionValues compilerOptions, PrintStream out) {\n        boolean all = HotSpotGraalCompilerFactory.Options.PrintPropertiesAll.getValue(compilerOptions);\n        compilerOptions.printHelp(OptionsParser.getOptionsLoader(), out, GRAAL_OPTION_PROPERTY_PREFIX, all);\n        LibGraalSupport libgraal = LibGraalSupport.INSTANCE;\n        if (all && libgraal != null) {","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/HotSpotGraalOptionValues.java#L126-L162","documentation":"stripPrefix removes a known property prefix (e.g. 'graal.' or the libgraal VM-option prefix) to get the option name; if nothing remains (baseName.isEmpty()), the property was exactly the prefix with no option name, and IllegalArgumentException('Option name must follow ... prefix') is thrown while parsing -Dgraal.* properties.","triggerScenarios":"Setting a property that equals the bare prefix — e.g. -Dgraal. (or the libgraal VM option prefix with no suffix) on the java command line or in the environment; the check runs for every property whose name starts with a recognized prefix during HotSpotGraalOptionValues.parseOptions.","commonSituations":"Shell scripts that concatenate an empty variable into -Dgraal.$VAR; quoted empty strings in JAVA_TOOL_OPTIONS/JDK_JAVA_OPTIONS; typos truncating a property name to just the prefix.","solutions":["Find and remove the empty -Dgraal. style property (check the command line, JAVA_TOOL_OPTIONS, JDK_JAVA_OPTIONS, and JAVA_OPTS env)","Fix the script so variable expansion cannot produce an empty option name (guard with a conditional or :+ expansion)","Inspect the failing prefix in the message to know which property family is truncated"],"exampleFix":"# before (VAR is empty -> \"-Dgraal.\")\nexec java -Dgraal.${GRAAL_EXTRA_OPT} MyApp\n\n# after\nexec java ${GRAAL_EXTRA_OPT:+-Dgraal.$GRAAL_EXTRA_OPT} MyApp","handlingStrategy":"validation","validationCode":"for (String k : System.getProperties().stringPropertyNames()) {\n    if (k.equals(\"graal.\") || k.endsWith(\".\") && k.startsWith(\"graal\")) { /* reject misconfigured property set */ }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Guard variable expansion producing flags: use ${VAR:+-Dgraal.$VAR}","Validate that every -D option has a non-empty name before exec'ing java","Check JDK_JAVA_OPTIONS/JAVA_TOOL_OPTIONS for truncation"],"tags":["graal-compiler","options","configuration","startup"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}