{"record":{"id":"e08e2813038a17ef","repo":"NationalSecurityAgency/ghidra","slug":"missing-required-parameter-e08e28","errorCode":null,"errorMessage":"Missing required parameter: {}","messagePattern":"Missing required parameter: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/ingest/BSimLaunchable.java","lineNumber":358,"sourceCode":"\t\t\t\tbooleanOptions.add(option);\n\t\t\t}\n\t\t\telse if (!StringUtils.isBlank(value)) {\n\t\t\t\toptionValueMap.put(option, value);\n\t\t\t}\n\t\t\telse {\n\t\t\t\t// consume next param as option value\n\t\t\t\tif (++i == params.length) {\n\t\t\t\t\tthrow new IllegalArgumentException(\"Missing option value: \" + optionName);\n\t\t\t\t}\n\t\t\t\toptionValueMap.put(option, params[i]);\n\t\t\t}\n\t\t}\n\t\treturn subParams;\n\t}\n\n\tprivate void checkRequiredParam(String[] params, int index, String name) {\n\t\tif (params.length <= index) {\n\t\t\tthrow new IllegalArgumentException(\"Missing required parameter: \" + name);\n\t\t}\n\t\tString p = params[index];\n\t\tif (p.startsWith(\"--\") || p.contains(\"=\")) {\n\t\t\tthrow new IllegalArgumentException(\n\t\t\t\t\"Missing required parameter (\" + name + \") before specified option: \" + p);\n\t\t}\n\t}\n\n\tprivate Integer parsePositiveIntegerOption(String option) {\n\t\tString optionValue = optionValueMap.get(option);\n\t\tif (optionValue == null) {\n\t\t\treturn null;\n\t\t}\n\t\ttry {\n\t\t\tint value = Integer.valueOf(optionValue);\n\t\t\tif (value < 0) {\n\t\t\t\tthrow new IllegalArgumentException(\"Negative value not permitted for \" + option);\n\t\t\t}","sourceCodeStart":340,"sourceCodeEnd":376,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/ingest/BSimLaunchable.java#L340-L376","documentation":"Thrown by checkRequiredParam() when the params array is too short to contain a required positional argument. All BSim commands require at least two positional arguments: the command name (params[0]) and a URL (params[1]). Some commands require additional positional parameters.","triggerScenarios":"Running 'bsim createdatabase' with no URL argument (params has only 1 element, but index 1 is required). Or running 'bsim' alone with no arguments (params[0] itself is missing).","commonSituations":"Forgetting the URL argument; running with no arguments to see usage (BSim does not print help in this case, it throws); a wrapper script that drops arguments.","solutions":["Provide both the command name and URL: 'bsim <command> <url> [options]'.","Check the command's documentation for required positional parameters beyond URL.","Verify that wrapper scripts or build tools pass all arguments through correctly."],"exampleFix":"// before\nbsim createdatabase\n// error: Missing required parameter: URL\n\n// after\nbsim createdatabase h2://localhost/mybsimdb","handlingStrategy":"validation","validationCode":"if (args.length < 2) {\n    System.err.println(\"Usage: bsim <command> <url> [options]\");\n    System.err.println(\"Commands: createdatabase, dropdatabase, setmetadata, ...\");\n    throw new IllegalArgumentException(\"Missing required arguments\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always provide at least a command name and URL as the first two arguments.","Build a usage/help wrapper that checks arg count before delegating to BSimLaunchable.run().","Validate argument count in wrapper scripts before calling the BSim tool."],"tags":["bsim","ghidra","command-line","argument-parsing","cli-usage"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}