oracle/graal · warning · InvalidArgumentException
no value provided
Error message
no value provided
What it means
InvalidArgumentException from DoubleValue.parseValue: the option was declared as a Double but parseValue received null, i.e. the option name appeared without any value at the point of parsing. This is the 'missing operand' case, distinct from the 'unparseable number' case handled by the sibling 'invalid double value' error.
Source
Thrown at compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/util/args/DoubleValue.java:42
*/
package jdk.graal.compiler.util.args;
/**
* Parses a {@link Double} from command line arguments.
*/
public class DoubleValue extends OptionValue<Double> {
public DoubleValue(String name, String help) {
super(name, help);
}
public DoubleValue(String name, Double defaultValue, String help) {
super(name, defaultValue, help);
}
@Override
public boolean parseValue(String arg) throws InvalidArgumentException {
if (arg == null) {
throw new InvalidArgumentException(getName(), "no value provided");
}
try {
value = Double.valueOf(arg);
return true;
} catch (NumberFormatException e) {
throw new InvalidArgumentException(getName(), String.format("invalid double value: \"%s\"", arg));
}
}
}
View on GitHub (pinned to a66e9ccd1d)
Solutions
- Always pass a value: '--threshold=0.85' or 'threshold 0.85' per the parser's convention.
- Give the option a default at construction time (new DoubleValue(name, defaultValue, help)) so omitting it entirely is valid.
- Catch InvalidArgumentException at the CLI boundary and print the failing option name with its help.
Example fix
# before $ tool --threshold # null value # after $ tool --threshold=0.85
Defensive patterns
Strategy: validation
Validate before calling
// Ensure every double option token carries a value before parsing
for (int i = 0; i < args.length; i++) {
if (isDoubleOption(args[i]) && !args[i].contains("=") && i + 1 >= args.length) {
fail(args[i] + " requires a numeric value, e.g. " + args[i] + "=0.85");
}
} Try / catch
try {
cmd.parse(args);
} catch (InvalidArgumentException e) {
if ("no value provided".equals(e.getMessage())) {
System.err.println(e.getOption() + " needs a value like " + e.getOption() + "=1.5");
} else throw e;
} Prevention
- Prefer '='-style ('--opt=0.85') in scripts so name and value cannot separate.
- Declare sensible defaults via the (name, defaultValue, help) constructor.
- Validate generated arg arrays in tests before shipping CLI wrappers.
When it happens
Trigger: A Command/OptionValue-based CLI where a double option token appears as the last argument (or its value element was dropped), so the framework calls DoubleValue.parseValue(null).
Common situations: Shell line wrapping that drops the value; scripts that append the option name conditionally but the value unconditionally (or vice versa); users expecting flag-style '--threshold' to imply a default.
Related errors
- invalid double value: "%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/ba0a7b1ccffedc6f.
Report an issue: GitHub.