oracle/graal · error · MissingArgumentException
The argument ' ' is required.
Error message
The argument '%s' is required.
What it means
Thrown after the token loop when a required option argument (registered with isRequired()==true) was never set on the command line. The parser iterates all optionArguments and raises MissingArgumentException with the option's name. Defaults do not apply because the argument was declared required.
Solutions
- Add the missing required flag named in the exception message, using the exact '--name' spelling.
- Run the command's help to see which options are bracketed (optional) vs required in the usage string.
- If scripting, validate that all required flags are present before invoking profdiff.
Example fix
# before mx profdiff normal-tier --experiment1 out1 # after mx profdiff normal-tier --experiment1 out1 --experiment2 out2
Defensive patterns
Strategy: validation
Validate before calling
// Ensure every required option is present before parse
for (var entry : parser.getOptionArguments().getEntries()) {
if (entry.getValue().isRequired() && !entry.getValue().isSet()) {
// check args contains entry.getKey() or entry.getKey() + "="
}
} Try / catch
try {
parser.parse(args);
} catch (MissingArgumentException e) {
System.err.println("Missing required argument: " + e.getMessage());
System.exit(1);
} Prevention
- Script a pre-flight check that all required flags are non-empty.
- Treat empty CI variables as build failures before invoking profdiff.
When it happens
Trigger: Invoking a profdiff command that declares a required option (e.g. an input path flag) without supplying it, or supplying it only for the other experiment of a pair (one '--experimentN' given, the other missing).
Common situations: Running a diff command with only one experiment specified, scripts written against an older interface where the option was optional or had a default, or CI jobs that strip arguments.
Related errors
- Unknown option ' '.
- The argument ' ' could not be parsed: expected true or false
- The argument ' ' could not be parsed: invalid command name
- invalid boolean value
- invalid double value
AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14).
Data as JSON: /api/errors/c59ae924d79d4493.
Report an issue: GitHub.
Appendix: source
Thrown at compiler/src/org.graalvm.profdiff/src/org/graalvm/profdiff/args/ArgumentParser.java:94
Argument argument;
if (arg.startsWith(Argument.OPTION_PREFIX)) {
int equalSignIndex = arg.indexOf(Argument.EQUAL_SIGN);
String optionArgumentName = equalSignIndex == -1 ? arg : arg.substring(0, equalSignIndex);
argument = optionArguments.get(optionArgumentName);
if (argument == null) {
throw new UnknownArgumentException(arg);
}
} else {
if (nextPositionalArg >= positionalArguments.size()) {
throw new UnknownArgumentException(arg);
}
argument = positionalArguments.get(nextPositionalArg++);
}
index = argument.parse(args, index);
}
for (Argument argument : optionArguments.getValues()) {
if (!argument.isSet() && argument.isRequired()) {
throw new MissingArgumentException(argument.getName());
}
}
if (nextPositionalArg < positionalArguments.size() && positionalArguments.get(nextPositionalArg).isRequired()) {
throw new MissingArgumentException(positionalArguments.get(nextPositionalArg).getName());
}
}
/**
* Gets options argument mapped by argument name.
*/
public EconomicMap<String, Argument> getOptionArguments() {
return optionArguments;
}
/**
* Gets the list of positional arguments.
*/
public List<Argument> getPositionalArguments() {View on GitHub (pinned to a66e9ccd1d)