{"record":{"id":"6b1270c3f85bb31d","repo":"NationalSecurityAgency/ghidra","slug":"must-specify-either-bsim-or-config-option","errorCode":null,"errorMessage":"Must specify either --bsim or --config option","messagePattern":"Must specify either --bsim or --config option","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/ingest/BSimLaunchable.java","lineNumber":511,"sourceCode":"\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\n\t */\n\tpublic void run(String[] params) throws Exception {\n\t\trun(params, TaskMonitor.DUMMY);\n\t}\n\n\t/**\n\t * Creates a new BSim database with a given set of properties.\n\t * \n\t * @param params the command-line parameters","sourceCodeStart":493,"sourceCodeEnd":529,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/ingest/BSimLaunchable.java#L493-L529","documentation":"Thrown by processSigAndUpdateOptions() when neither --bsim nor --config is supplied to a generatesigs or generateupdates command. BSim needs exactly one of these to know which BSim database will receive the generated signatures: --bsim points at a live BSim server URL for direct commit, while --config provides a configuration template name (e.g. medium_64) for generating signature XML files only. Without either, the command has no target and cannot proceed.","triggerScenarios":"Running 'generatesigs <ghidraURL>' or 'generateupdates <ghidraURL>' without any --bsim or --config option on the command line. The check at BSimLaunchable.java:498-513 finds both optionValueMap.get(BSIM_URL_OPTION) and optionValueMap.get(CONFIG_OPTION) are null after readOptions() has parsed args.","commonSituations":"Following a tutorial that shows the short form '-b <url>' but typing it wrong; assuming the tool infers the BSim target from the ghidra URL argument; upgrading from an older BSim version where the option was optional; forgetting the option entirely when scripting a bulk signature generation pipeline.","solutions":["Add exactly one of: --bsim <bsimURL> (to commit directly) or --config <template> (to write XML files).","Run 'bsim' with no arguments to see the usage block (lines 1020-1066) which lists the three valid generatesigs/generateupdates invocations.","If committing to a server, use the form: generatesigs <ghidraURL> --bsim|-b <bsimURL> [--commit].","If generating XML only, use: generatesigs <ghidraURL> </xmldirectory> --config|-c <template> [--overwrite]."],"exampleFix":"// before\nbsim generatesigs ghidra://myhost/MyRepo\n// after\nbsim generatesigs ghidra://myhost/MyRepo --bsim postgresql://myhost/BsimDB\n// or\nbsim generatesigs ghidra://myhost/MyRepo /tmp/xmlout --config medium_64","handlingStrategy":"validation","validationCode":"// Pre-flight check before calling run() for generatesigs/generateupdates\nString bsimOpt = optionValueMap.get(\"--bsim\");\nString configOpt = optionValueMap.get(\"--config\");\nif (bsimOpt == null && configOpt == null) {\n    throw new IllegalArgumentException(\n        \"generatesigs/generateupdates requires either --bsim <url> or --config <template>\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate that exactly one of --bsim or --config is present before dispatching to run().","When scripting, fail fast with a clear error rather than letting the CLI exit code 22 surface.","Centralize generatesigs/generateupdates argument validation in a shared helper since they share processSigAndUpdateOptions()."],"tags":["cli","argument-validation","bsim","missing-option"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}