{"record":{"id":"ba0a7b1ccffedc6f","repo":"oracle/graal","slug":"no-value-provided-ba0a7b","errorCode":null,"errorMessage":"no value provided","messagePattern":"no value provided","errorType":"validation","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"warning","filePath":"compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/util/args/DoubleValue.java","lineNumber":42,"sourceCode":" */\npackage jdk.graal.compiler.util.args;\n\n/**\n * Parses a {@link Double} from command line arguments.\n */\npublic class DoubleValue extends OptionValue<Double> {\n    public DoubleValue(String name, String help) {\n        super(name, help);\n    }\n\n    public DoubleValue(String name, Double defaultValue, String help) {\n        super(name, defaultValue, help);\n    }\n\n    @Override\n    public boolean parseValue(String arg) throws InvalidArgumentException {\n        if (arg == null) {\n            throw new InvalidArgumentException(getName(), \"no value provided\");\n        }\n        try {\n            value = Double.valueOf(arg);\n            return true;\n        } catch (NumberFormatException e) {\n            throw new InvalidArgumentException(getName(), String.format(\"invalid double value: \\\"%s\\\"\", arg));\n        }\n    }\n}\n","sourceCodeStart":24,"sourceCodeEnd":52,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/util/args/DoubleValue.java#L24-L52","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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."],"exampleFix":"# before\n$ tool --threshold        # null value\n\n# after\n$ tool --threshold=0.85","handlingStrategy":"validation","validationCode":"// Ensure every double option token carries a value before parsing\nfor (int i = 0; i < args.length; i++) {\n    if (isDoubleOption(args[i]) && !args[i].contains(\"=\") && i + 1 >= args.length) {\n        fail(args[i] + \" requires a numeric value, e.g. \" + args[i] + \"=0.85\");\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    cmd.parse(args);\n} catch (InvalidArgumentException e) {\n    if (\"no value provided\".equals(e.getMessage())) {\n        System.err.println(e.getOption() + \" needs a value like \" + e.getOption() + \"=1.5\");\n    } else throw e;\n}","preventionTips":["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."],"tags":["cli","arguments","double","parsing","options"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}