{"record":{"id":"01d2a124dba4f7bb","repo":"NationalSecurityAgency/ghidra","slug":"invalid-option-use-overwrite","errorCode":null,"errorMessage":"Invalid option use: --overwrite","messagePattern":"Invalid option use: --overwrite","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/ingest/BSimLaunchable.java","lineNumber":606,"sourceCode":"\t\t// concurrent --bsim and --config option use already checked\n\t\tif (params.size() > 1) {\n\t\t\tthrow new IllegalArgumentException(\"Invalid generatesigs parameter use!\");\n\t\t}\n\t\tboolean commitOption = booleanOptions.contains(COMMIT_OPTION);\n\t\tboolean overwriteOption = booleanOptions.contains(OVERWRITE_OPTION);\n\t\tString configOption = optionValueMap.get(CONFIG_OPTION);\n\n\t\tString xmlDirectory = null;\n\t\tif (params.size() == 1) {\n\t\t\txmlDirectory = params.get(0);\n\t\t\tif (configOption != null && commitOption) {\n\t\t\t\tthrow new IllegalArgumentException(\n\t\t\t\t\t\"Invalid option use with \" + CONFIG_OPTION + \" option: \" + COMMIT_OPTION);\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tif (overwriteOption) {\n\t\t\t\tthrow new IllegalArgumentException(\"Invalid option use: \" + OVERWRITE_OPTION);\n\t\t\t}\n\t\t\tcommitOption = true; // assume DB commit using temp XML directory\n\t\t}\n\n\t\ttry (BulkSignatures bsim = getBulkSignatures()) {\n\t\t\tif (commitOption) {\n\t\t\t\t// Generate and commit signatures to BSim database\n\t\t\t\tbsim.signatureRepo(ghidraURL, xmlDirectory, overwriteOption, monitor);\n\t\t\t}\n\t\t\telse {\n\t\t\t\t// Generate sig XML files only\n\t\t\t\tbsim.generateSignaturesFromServer(ghidraURL, xmlDirectory, overwriteOption,\n\t\t\t\t\tconfigOption, monitor);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate void doGenerateUpdates(List<String> params, TaskMonitor monitor)","sourceCodeStart":588,"sourceCodeEnd":624,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/ingest/BSimLaunchable.java#L588-L624","documentation":"Thrown by doGenerateSigs() when --overwrite is supplied but no XML output directory is given (params is empty). When no directory is specified, BSim uses a temporary directory and commits directly, making --overwrite meaningless because temp dirs don't contain pre-existing files to overwrite. The guard at line 605 enforces this.","triggerScenarios":"Command: generatesigs <ghidraURL> --bsim <bsimURL> --overwrite (no positional XML dir). params.size() != 1, so the else branch at line 604 runs; overwriteOption is true, triggering line 606.","commonSituations":"Using --overwrite as a general 'force' flag without understanding it only applies to an explicit output directory; copying flags from a directory-based command into the temp-dir commit form.","solutions":["Provide an explicit XML output directory if you want --overwrite to apply: generatesigs <ghidraURL> <xmldir> --bsim <url> --overwrite.","Or remove --overwrite when committing without an explicit directory (the temp dir is always fresh)."],"exampleFix":"// before\nbsim generatesigs ghidra://myhost/Repo --bsim postgresql://myhost/BsimDB --overwrite\n// after\nbsim generatesigs ghidra://myhost/Repo /tmp/xmlout --bsim postgresql://myhost/BsimDB --overwrite","handlingStrategy":"validation","validationCode":"// --overwrite requires an explicit XML directory positional\nboolean overwrite = booleanOptions.contains(\"--overwrite\");\nif (overwrite && positionalParams.isEmpty()) {\n    throw new IllegalArgumentException(\"--overwrite requires an explicit XML output directory\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Do not treat --overwrite as a universal force flag; it only applies to an explicit output directory.","When committing via temp dir, omit --overwrite entirely."],"tags":["cli","argument-validation","bsim","generatesigs","conflicting-options"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}