{"record":{"id":"967912b8cb6f434f","repo":"NationalSecurityAgency/ghidra","slug":"missing-required-parameter-before-specified-o","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/BSimControlLaunchable.java","lineNumber":361,"sourceCode":"\t\t\t}\n\t\t}\n\n\t\tif (sawNoLocalAuth) {\t// Turn off authentication for local connections\n\t\t\tauthConfigPresent = true;\n\t\t\tlocalAuthentication = AUTHENTICATION_NONE;\n\t\t}\n\t\tif (connectingUserName == null) {\n\t\t\tconnectingUserName = ClientUtil.getUserName();\n\t\t}\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(\"--\")) {\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 int parsePositiveIntegerOption(String option, String optionValue) {\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);\n\t\t}\n\t}\n\n\t/**","sourceCodeStart":343,"sourceCodeEnd":379,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/BSimControlLaunchable.java#L343-L379","documentation":"Thrown by checkRequiredParam when the slot that should hold a required positional argument instead contains a '--' option token. This means an option appeared before a required positional was supplied, so the parser cannot fill the positional slot.","triggerScenarios":"Placing options before a required positional, e.g. `bsim control configure --port 5432 myhost` where configure expects the host first (line 361).","commonSituations":"Reordering args so options come first, or assuming options can precede positionals like in some other CLIs.","solutions":["Move the required positional argument before the options.","Keep the convention: positionals first, then --options.","Use --help to confirm the expected positional order."],"exampleFix":"// before\nbsim control configure --port 5432 myhost\n// after\nbsim control configure myhost --port 5432","handlingStrategy":"validation","validationCode":"// Required positionals must precede any --option token.\nfor (int i = 0; i < requiredPositionalCount; i++) {\n    if (i < params.length && params[i].startsWith(\"--\")) {\n        System.err.println(\"Required positional #\" + (i + 1) + \" missing before option \" + params[i]);\n        return;\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    launchable.checkRequiredParam(params, index, name);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Missing required parameter (\")) {\n        System.err.println(\"Put required positional arguments before the options.\");\n    }\n    throw e;\n}","preventionTips":["Enforce positionals-first ordering in your wrapper scripts.","Validate that no --option appears before the required positional slots are filled.","Document the canonical argument order per subcommand."],"tags":["cli","argument-validation","bsim"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}