oracle/graal · error · IllegalArgumentException
Option name must follow '<prefix>' prefix
Error message
Option name must follow '<prefix>' prefix
What it means
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.
Source
Thrown at compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/HotSpotGraalOptionValues.java:144
}
if (!vmOptionSettings.isEmpty()) {
LibGraalSupport libgraal = LibGraalSupport.INSTANCE;
if (libgraal != null) {
libgraal.notifyOptions(vmOptionSettings);
} else {
System.err.printf("WARNING: Ignoring the following libgraal VM option(s) while executing jargraal: %s%n", vmOptionSettings);
}
}
OptionsParser.parseOptions(compilerOptionSettings, compilerOptionValues, descriptors);
return compilerOptionValues;
}
}
private static String stripPrefix(String name, String prefix) {
String baseName = name.substring(prefix.length());
if (baseName.isEmpty()) {
throw new IllegalArgumentException("Option name must follow '" + prefix + "' prefix");
}
return baseName;
}
private static OptionValues initializeOptions() {
EconomicMap<OptionKey<?>, Object> values = parseOptions();
OptionValues options = new OptionValues(values);
if (HotSpotGraalCompiler.Options.CrashAtThrowsOOME.getValue(options) && HotSpotGraalCompiler.Options.CrashAtIsFatal.getValue(options) != 0) {
throw new IllegalArgumentException("CrashAtThrowsOOME and CrashAtIsFatal cannot both be enabled");
}
return options;
}
static void printProperties(OptionValues compilerOptions, PrintStream out) {
boolean all = HotSpotGraalCompilerFactory.Options.PrintPropertiesAll.getValue(compilerOptions);
compilerOptions.printHelp(OptionsParser.getOptionsLoader(), out, GRAAL_OPTION_PROPERTY_PREFIX, all);
LibGraalSupport libgraal = LibGraalSupport.INSTANCE;
if (all && libgraal != null) {View on GitHub (pinned to a66e9ccd1d)
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
Example fix
# before (VAR is empty -> "-Dgraal.")
exec java -Dgraal.${GRAAL_EXTRA_OPT} MyApp
# after
exec java ${GRAAL_EXTRA_OPT:+-Dgraal.$GRAAL_EXTRA_OPT} MyApp Defensive patterns
Strategy: validation
Validate before calling
for (String k : System.getProperties().stringPropertyNames()) {
if (k.equals("graal.") || k.endsWith(".") && k.startsWith("graal")) { /* reject misconfigured property set */ }
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- No options specified for MethodFilter:
- Compiler configuration '%s' not found. Available configurati
- The '%s' property is no longer supported.
- CrashAtThrowsOOME and CrashAtIsFatal cannot both be enabled
- SpectrePHTBarriers can be set to 'AllTargets' if and only if
AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14).
Data as JSON: /api/errors/ff78735639b55cf1.
Report an issue: GitHub.