oracle/graal · error · IllegalArgumentException
No options specified for MethodFilter:
Error message
No options specified for MethodFilter:
What it means
When Options.PerMethodOptions is parsed, a MethodFilter: line starts collecting option settings until the next line; if the collected map is empty when parsing ends, IllegalArgumentException('No options specified for MethodFilter:') is thrown. The enclosing catch prints the error and calls HotSpotGraalServices.exit(-1), so the JVM terminates.
Source
Thrown at compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/CompilationTask.java:545
EconomicMap<String, String> optionSettings = null;
for (String option : OptionsParser.splitOptions(perMethodOptions)) {
String prefix = "MethodFilter:";
if (option.startsWith(prefix)) {
MethodFilter filter = MethodFilter.parse(option.substring(prefix.length()));
if (filter.matches(getMethod())) {
// Begin accumulating options
optionSettings = EconomicMap.create();
} else if (optionSettings != null) {
// This is a new MethodFilter: so stop collecting options
break;
}
} else if (optionSettings != null) {
OptionsParser.parseOptionSettingTo(option, optionSettings);
}
}
if (optionSettings != null) {
if (optionSettings.isEmpty()) {
throw new IllegalArgumentException("No options specified for MethodFilter:");
}
values = EconomicMap.create();
OptionsParser.parseOptions(optionSettings, values, OptionsParser.getOptionsLoader());
}
} catch (Exception e) {
values = null;
TTY.println(e.toString());
TTY.println("Errors encountered during " + Options.PerMethodOptions.getName() + " parsing. Exiting...");
HotSpotGraalServices.exit(-1, jvmciRuntime);
}
if (values != null) {
newOptions = newOptions.derive(values);
if (PrintCompilation.getValue(newOptions)) {
TTY.println("Compiling " + getMethod() + " with extra options: " + new OptionValues(values));
}
}
}View on GitHub (pinned to a66e9ccd1d)
Solutions
- Ensure every MethodFilter: entry is followed by at least one option assignment (e.g. MethodFilter:Foo, then a subsequent 'OptionName = value' line)
- Remove the stray/trailing MethodFilter: line that has no options
- Validate the PerMethodOptions content before startup (lint the file) since the failure kills the JVM
Example fix
# before (-Dgraal.PerMethodOptions content) MethodFilter:HotSpotBlowup.* # after MethodFilter:HotSpotBlowup.* InlineEverything = true
Defensive patterns
Strategy: validation
Validate before calling
boolean perMethodOptionsOk(String s) {
String[] lines = s.split("\n");
boolean sawFilter = false;
for (String l : lines) {
if (l.startsWith("MethodFilter:")) { if (sawFilter) return false; sawFilter = true; }
else if (sawFilter && l.matches("\\s*\\w+\\s*=.*")) sawFilter = false;
}
return !sawFilter; // false means a MethodFilter with no options follows
} Prevention
- Lint PerMethodOptions strings/files before launching (failure exits the JVM)
- End every MethodFilter: block with at least one Option = value line
- Unit-test option files in CI with the same parser settings
When it happens
Trigger: Setting -Dgraal.PerMethodOptions to a value/string containing a 'MethodFilter:' line (or a line that starts a new filter) that is the last line, or is followed only by another MethodFilter: line, so zero options accumulate for it.
Common situations: Trailing 'MethodFilter:...' entry with no key=value lines after it in a per-method options file or -Dgraal.PerMethodOptions string; typos like 'MethodFilter:Foo' followed by an option line the parser does not recognize as such; copy-paste truncation of an options file.
Related errors
- Option name must follow '<prefix>' prefix
- 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/eed95135d895ffa8.
Report an issue: GitHub.