{"record":{"id":"1ee71e808dc98402","repo":"NationalSecurityAgency/ghidra","slug":"missing-option-value","errorCode":null,"errorMessage":"Missing option value: {}","messagePattern":"Missing option value: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/BSimControlLaunchable.java","lineNumber":293,"sourceCode":"\t\t\tif (!option.startsWith(\"--\")) {\n\t\t\t\tthrow new IllegalArgumentException(\"Unexpected argument: \" + option);\n\t\t\t}\n\n\t\t\tif (!GLOBAL_OPTIONS.contains(option) && !allowedParams.contains(option)) {\n\t\t\t\tthrow new IllegalArgumentException(\"Unsupported option use: \" + optionName);\n\t\t\t}\n\n\t\t\tif (!VALUE_OPTIONS.contains(option)) {\n\t\t\t\t// option without value arg\n\t\t\t\tif (value != null) {\n\t\t\t\t\tthrow new IllegalArgumentException(\n\t\t\t\t\t\t\"Unsupported option specification: \" + optionName + \"=\");\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (StringUtils.isBlank(value)) {\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\tvalue = params[i];\n\t\t\t}\n\n\t\t\tswitch (option) {\n\t\t\t\tcase PORT_OPTION:\n\t\t\t\t\tport = parsePositiveIntegerOption(optionName, value);\n\t\t\t\t\tbreak;\n\t\t\t\tcase USER_OPTION:\n\t\t\t\t\tconnectingUserName = value;\n\t\t\t\t\tbreak;\n\t\t\t\tcase CERT_OPTION:\n\t\t\t\t\tcertParameter = value;\n\t\t\t\t\tbreak;\n\t\t\t\tcase CAFILE_OPTION:\n\t\t\t\t\tcertAuthorityFile = new File(value);\n\t\t\t\t\tbreak;\n\t\t\t\tcase AUTH_OPTION:","sourceCodeStart":275,"sourceCodeEnd":311,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/BSimControlLaunchable.java#L275-L311","documentation":"Thrown when a value-taking option (a member of VALUE_OPTIONS) is the last token on the command line with no value following it. The parser attempts to consume the next param as the value but reaches the end of the array (line 293).","triggerScenarios":"Ending the command with a value-option and nothing after it, e.g. `bsim control configure host --port` with no port number.","commonSituations":"Truncated command lines, a value eaten by shell quoting/escaping, or copy-paste that cut off the trailing value.","solutions":["Provide the value immediately after the option: `--port 5432`.","Use the `--option=value` form to keep the pair together and shell-safe.","Check shell escaping for quotes/backslashes that consumed the value."],"exampleFix":"// before\nbsim control configure host --port\n// after\nbsim control configure host --port 5432","handlingStrategy":"validation","validationCode":"// Ensure every value-option has a following value (or inline =value) before launch.\nfor (int i = 0; i < params.length; i++) {\n    String p = params[i];\n    String name = p.contains(\"=\") ? p.substring(0, p.indexOf('=')) : p;\n    if (VALUE_OPTIONS.contains(name) && !p.contains(\"=\") && i == params.length - 1) {\n        System.err.println(name + \" requires a value but none follows.\");\n        return;\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    launchable.readOptions(command, params, discard);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Missing option value:\")) {\n        System.err.println(\"Supply a value for \" + e.getMessage());\n    }\n    throw e;\n}","preventionTips":["Prefer the --option=value form in scripts so the pair cannot be split by shell quoting.","Sanity-check that every value-option is followed by a value before invoking.","Watch for shell quoting that silently consumes the trailing value."],"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"}