{"record":{"id":"7c496c14af1511e4","repo":"NationalSecurityAgency/ghidra","slug":"unsupported-option-use","errorCode":null,"errorMessage":"Unsupported option use: {}","messagePattern":"Unsupported option use: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/BSimControlLaunchable.java","lineNumber":271,"sourceCode":"\t\tfor (int i = discard; i < params.length; ++i) {\n\t\t\tString optionName = params[i];\n\t\t\tString value = null;\n\n\t\t\tif (optionName.startsWith(\"-\")) {\n\t\t\t\t// although not prefered, allow option value to be specified as --option=value\n\t\t\t\tint ix = optionName.indexOf(\"=\");\n\t\t\t\tif (ix > 1) {\n\t\t\t\t\tvalue = optionName.substring(ix + 1);\n\t\t\t\t\toptionName = optionName.substring(0, ix);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tString option = optionName;\n\n\t\t\tif (optionName.startsWith(\"-\") && !optionName.startsWith(\"--\")) {\n\t\t\t\toption = SHORTCUT_OPTION_MAP.get(optionName); // map option to -- long form\n\t\t\t\tif (option == null) {\n\t\t\t\t\tthrow new IllegalArgumentException(\"Unsupported option use: \" + optionName);\n\t\t\t\t}\n\t\t\t}\n\n\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}","sourceCodeStart":253,"sourceCodeEnd":289,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/BSimControlLaunchable.java#L253-L289","documentation":"Thrown when an argument starts with a single dash '-' but not '--', and that token is not a registered key in SHORTCUT_OPTION_MAP. The tool resolves single-dash shortcuts to their long form; an unmapped shortcut is rejected.","triggerScenarios":"Passing an unknown short flag such as `-x` or `-p` where `-p` is not a registered shortcut (line 271). Any single-dash token absent from SHORTCUT_OPTION_MAP triggers it.","commonSituations":"Using a single dash for what should be a long option (e.g. `-port` instead of `--port`), assuming a shortcut exists when it does not, or typos in shortcut flags.","solutions":["Switch to the canonical long form, e.g. `--port` instead of `-port`.","Verify the shortcut actually exists by checking SHORTCUT_OPTION_MAP in source.","Run --help to see the accepted options and their shortcuts."],"exampleFix":"// before\nbsim control configure host -p 5432   // if -p is unmapped\n// after\nbsim control configure host --port 5432","handlingStrategy":"validation","validationCode":"// Resolve single-dash shortcuts yourself before delegating, or reject unknown ones early.\nString resolved = SHORTCUT_OPTION_MAP.containsKey(token) ? SHORTCUT_OPTION_MAP.get(token) : null;\nif (token.startsWith(\"-\") && !token.startsWith(\"--\") && resolved == null) {\n    System.err.println(\"Unknown shortcut: \" + token + \". Use a --long option.\");\n    return;\n}","typeGuard":null,"tryCatchPattern":"try {\n    launchable.readOptions(command, params, discard);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Unsupported option use:\")) {\n        suggestLongFormOptions();\n    }\n    throw e;\n}","preventionTips":["Prefer the canonical --long form in scripts and docs to avoid shortcut ambiguity.","Document the registered shortcuts next to each long option.","Reject unknown single-dash tokens early with a helpful message."],"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"}