{"record":{"id":"c59ae924d79d4493","repo":"oracle/graal","slug":"the-argument-s-is-required","errorCode":null,"errorMessage":"The argument '%s' is required.","messagePattern":"The argument '(.+?)' is required\\.","errorType":"validation","errorClass":"MissingArgumentException","httpStatus":null,"severity":"error","filePath":"compiler/src/org.graalvm.profdiff/src/org/graalvm/profdiff/args/ArgumentParser.java","lineNumber":94,"sourceCode":"            Argument argument;\n            if (arg.startsWith(Argument.OPTION_PREFIX)) {\n                int equalSignIndex = arg.indexOf(Argument.EQUAL_SIGN);\n                String optionArgumentName = equalSignIndex == -1 ? arg : arg.substring(0, equalSignIndex);\n                argument = optionArguments.get(optionArgumentName);\n                if (argument == null) {\n                    throw new UnknownArgumentException(arg);\n                }\n            } else {\n                if (nextPositionalArg >= positionalArguments.size()) {\n                    throw new UnknownArgumentException(arg);\n                }\n                argument = positionalArguments.get(nextPositionalArg++);\n            }\n            index = argument.parse(args, index);\n        }\n        for (Argument argument : optionArguments.getValues()) {\n            if (!argument.isSet() && argument.isRequired()) {\n                throw new MissingArgumentException(argument.getName());\n            }\n        }\n        if (nextPositionalArg < positionalArguments.size() && positionalArguments.get(nextPositionalArg).isRequired()) {\n            throw new MissingArgumentException(positionalArguments.get(nextPositionalArg).getName());\n        }\n    }\n\n    /**\n     * Gets options argument mapped by argument name.\n     */\n    public EconomicMap<String, Argument> getOptionArguments() {\n        return optionArguments;\n    }\n\n    /**\n     * Gets the list of positional arguments.\n     */\n    public List<Argument> getPositionalArguments() {","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/compiler/src/org.graalvm.profdiff/src/org/graalvm/profdiff/args/ArgumentParser.java#L76-L112","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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."],"exampleFix":"# before\nmx profdiff normal-tier --experiment1 out1\n# after\nmx profdiff normal-tier --experiment1 out1 --experiment2 out2","handlingStrategy":"validation","validationCode":"// Ensure every required option is present before parse\nfor (var entry : parser.getOptionArguments().getEntries()) {\n    if (entry.getValue().isRequired() && !entry.getValue().isSet()) {\n        // check args contains entry.getKey() or entry.getKey() + \"=\"\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    parser.parse(args);\n} catch (MissingArgumentException e) {\n    System.err.println(\"Missing required argument: \" + e.getMessage());\n    System.exit(1);\n}","preventionTips":["Script a pre-flight check that all required flags are non-empty.","Treat empty CI variables as build failures before invoking profdiff."],"tags":["cli","arguments","profdiff","usage-error"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}