{"record":{"id":"b3bb261b5c9faa87","repo":"NationalSecurityAgency/ghidra","slug":"missing-required-parameter-before-specified-o-b3bb26","errorCode":null,"errorMessage":"Missing required parameter ({}) before specified option: {}","messagePattern":"Missing required parameter \\((.+?)\\) before specified option: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/ingest/BSimLaunchable.java","lineNumber":362,"sourceCode":"\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}\n\t\t\treturn value;\n\t\t}\n\t\tcatch (NumberFormatException e) {\n\t\t\tthrow new IllegalArgumentException(\"Invalid integer value specified for \" + option);","sourceCodeStart":344,"sourceCodeEnd":380,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/ingest/BSimLaunchable.java#L344-L380","documentation":"Thrown by checkRequiredParam() when the required positional parameter slot is occupied by a token that looks like an option (starts with '--' or contains '='). This means a required positional argument was omitted and the parser is seeing an option where it expected a value like a command name or URL.","triggerScenarios":"Running 'bsim createdatabase --user admin' where the URL (params[1]) slot is occupied by '--user'. Or 'bsim --config foo createdatabase' where the command (params[0]) slot is '--config'. The required positional parameter was skipped.","commonSituations":"Putting options before required positional arguments; a wrapper or alias that prepends options before the command; forgetting the URL between the command and the options.","solutions":["Place all required positional arguments (command, URL) before any -- options.","Ensure the command name is the first argument and the URL is the second.","Review wrapper scripts to confirm they emit arguments in the correct order."],"exampleFix":"// before\nbsim createdatabase --name MyDB h2://localhost/mybsimdb\n// error: Missing required parameter (URL) before specified option: --name\n\n// after\nbsim createdatabase h2://localhost/mybsimdb --name MyDB","handlingStrategy":"validation","validationCode":"// Ensure params[0] and params[1] are not options\nfor (int i = 0; i <= 1 && i < params.length; i++) {\n    if (params[i].startsWith(\"--\") || params[i].contains(\"=\")) {\n        throw new IllegalArgumentException(\n            \"Required positional parameter at index \" + i + \" is missing; found option: \" + params[i]);\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Place the command name first and the URL second, before any options.","Review wrapper scripts to ensure arguments are emitted in the correct order.","Never put -- options before the required positional arguments."],"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"}