oracle/graal · error · InvalidArgumentException
The argument '%s' could not be parsed: No value was provided
Error message
The argument '%s' could not be parsed: No value was provided.
What it means
Thrown by ValuedArgument.parse when an option appears as the very last token in '--name' form: the parser advances past it, sees offset >= args.length, and cannot find the following value token. It is an InvalidArgumentException('No value was provided.') for that argument.
Source
Thrown at compiler/src/org.graalvm.profdiff/src/org/graalvm/profdiff/args/ValuedArgument.java:80
set = true;
value = defaultValue;
}
/**
* Gets the value of the argument.
*/
public T getValue() {
return value;
}
@Override
public int parse(String[] args, int offsetBase) throws InvalidArgumentException {
int offset = offsetBase;
if (isOptionArgument()) {
if (args[offset].equals(getName())) {
++offset;
if (offset >= args.length) {
throw new InvalidArgumentException(getName(), "No value was provided.");
}
value = parseValue(args[offset]);
} else {
assert args[offset].startsWith(getName() + EQUAL_SIGN);
int equalSignIndex = args[offset].indexOf(EQUAL_SIGN);
assert equalSignIndex != -1;
value = parseValue(args[offset].substring(equalSignIndex + 1));
}
} else {
value = parseValue(args[offset]);
}
set = true;
return offset + 1;
}
/**
* Parse the argument value from a string.
*View on GitHub (pinned to a66e9ccd1d)
Solutions
- Append the value token after the option ('--experiment2 out2') or use the '--name=value' form, which cannot be split.
- Check empty/undefined shell variables used as option values; default them explicitly.
- Verify multi-line commands keep the continuation character on every line but the last.
Example fix
# before mx profdiff normal-tier --experiment1 out1 --experiment2 # after mx profdiff normal-tier --experiment1 out1 --experiment2 out2
Defensive patterns
Strategy: validation
Validate before calling
// Prefer '--name=value' form; if using two tokens, verify the value token exists
if (args[args.length - 1].startsWith("--") && !args[args.length - 1].contains("=")) {
throw new IllegalArgumentException("Trailing option without value: " + args[args.length - 1]);
} Try / catch
try {
parser.parse(args);
} catch (InvalidArgumentException e) {
if (e.getMessage().contains("No value was provided")) { /* append the missing value token */ }
} Prevention
- Use '--name=value' in scripts so value and option cannot be separated.
- Default empty shell variables explicitly: ${VAR:-fallback}.
When it happens
Trigger: Ending the command line with a value-taking option that has no value: '... --experiment2'. Also when a trailing value was consumed by the shell (unquoted expansion of an empty variable) so the token never reaches Java.
Common situations: Truncated command lines (copy-paste cut off), empty environment variables expanding to nothing ('--opt $EMPTY_VAR'), or line-continuation backslashes missing so the value lands on the next line as a separate command.
Related errors
- Unknown argument: %s
- no value provided
- invalid boolean value: "%s"
- no subcommand named '%s'
- no value provided
AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14).
Data as JSON: /api/errors/b60d94a88b830075.
Report an issue: GitHub.