{"record":{"id":"5de38cccce8962d2","repo":"NationalSecurityAgency/ghidra","slug":"bsim-and-config-options-may-not-both-be-presen","errorCode":null,"errorMessage":"--bsim and --config options may not both be present","messagePattern":"--bsim and --config options may not both be present","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/ingest/BSimLaunchable.java","lineNumber":502,"sourceCode":"\t\t\tbsimURL = BSimClientFactory.deriveBSimURL(urlstring);\n\t\t\tdoGetCount(subParams);\n\t\t}\n\t\telse if (COMMAND_DUMP_SIGS.equals(command)) {\n\t\t\tbsimURL = BSimClientFactory.deriveBSimURL(urlstring);\n\t\t\tdoDumpSigs(subParams);\n\t\t}\n\t\telse {\n\t\t\tthrow new IllegalArgumentException(\"Unknown command: \" + command);\n\t\t}\n\t}\n\n\tprivate void processSigAndUpdateOptions(String urlstring)\n\t\t\tthrows IllegalArgumentException, MalformedURLException, URISyntaxException {\n\t\tString bsimURLOption = optionValueMap.get(BSIM_URL_OPTION);\n\t\tString configOption = optionValueMap.get(CONFIG_OPTION);\n\t\tif (configOption != null) {\n\t\t\tif (bsimURLOption != null) {\n\t\t\t\tthrow new IllegalArgumentException(\n\t\t\t\t\tBSIM_URL_OPTION + \" and \" + CONFIG_OPTION + \" options may not both be present\");\n\t\t\t}\n\t\t\tsetupGhidraURL(urlstring);\n\t\t}\n\t\telse if (bsimURLOption != null) {\n\t\t\tsetupURLs(urlstring, bsimURLOption);\n\t\t}\n\t\telse {\n\t\t\tthrow new IllegalArgumentException(\n\t\t\t\t\"Must specify either \" + BSIM_URL_OPTION + \" or \" + CONFIG_OPTION + \" option\");\n\t\t}\n\t}\n\n\t/**\n\t * Runs the command specified by the given set of params.\n\t * \n\t * @param params the parameters specifying the command\n\t * @throws Exception when initializing the application or executing the command","sourceCodeStart":484,"sourceCodeEnd":520,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/ingest/BSimLaunchable.java#L484-L520","documentation":"Thrown by processSigAndUpdateOptions() when both --bsim and --config options are present in the same invocation. These are mutually exclusive: --config reads both the ghidra source and BSim target from a configuration file, while --bsim specifies the BSim URL directly (with the ghidra URL inferred from the positional URL argument). Specifying both creates an ambiguous configuration.","triggerScenarios":"Running 'generatesigs' or 'generateupdates' with both options, e.g., 'bsim generatesigs ghidra://server/Repo --config myconfig.xml --bsim h2://localhost/db'. The code detects both in optionValueMap and rejects immediately.","commonSituations":"Copy-pasting options from a previous run without removing the conflicting one; transitioning from --config-based to --bsim-based invocations and leaving the old option; misunderstanding that the two are alternative configuration mechanisms.","solutions":["Choose one configuration method: either --config <file> or --bsim <url>, not both.","If using --config, ensure the config file specifies the BSim target URL; remove the --bsim option.","If using --bsim, provide the ghidra repository URL as the positional argument; remove the --config option."],"exampleFix":"// before\nbsim generatesigs ghidra://server/Repo --config myconfig.xml --bsim h2://localhost/db\n// error: --bsim and --config options may not both be present\n\n// after (option A: use --bsim)\nbsim generatesigs ghidra://server/Repo --bsim h2://localhost/db\n\n// after (option B: use --config)\nbsim generatesigs ghidra://server/Repo --config myconfig.xml","handlingStrategy":"validation","validationCode":"if (optionValueMap.containsKey(\"--bsim\") && optionValueMap.containsKey(\"--config\")) {\n    throw new IllegalArgumentException(\n        \"Specify either --bsim or --config, not both.\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use --config for configuration-file-based workflows or --bsim for direct URL specification, never both.","When transitioning from one method to another, remove the old option from scripts and aliases.","Review the full command line for conflicting options before executing."],"tags":["bsim","ghidra","command-line","configuration","mutual-exclusion"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}