{"record":{"id":"711be58d96f81c1e","repo":"NationalSecurityAgency/ghidra","slug":"invalid-generatesigs-parameter-use","errorCode":null,"errorMessage":"Invalid generatesigs parameter use!","messagePattern":"Invalid generatesigs parameter use!","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/ingest/BSimLaunchable.java","lineNumber":590,"sourceCode":"\t\tConsole cons = System.console();\n\t\tif (cons == null) {\n\t\t\tSystem.out.println(\"Could not acquire console\");\n\t\t\treturn false;\n\t\t}\n\t\tSystem.out.print(\"Are you sure you want to drop the database? (y/n): \");\n\t\tString input = cons.readLine();\n\t\tif (input.equalsIgnoreCase(\"y\")) {\n\t\t\treturn true;\n\t\t}\n\t\tSystem.out.println(\"Database NOT dropped\");\n\t\treturn false;\n\t}\n\n\tprivate void doGenerateSigs(List<String> params, TaskMonitor monitor)\n\t\t\tthrows Exception, CancelledException {\n\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","sourceCodeStart":572,"sourceCodeEnd":608,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/ingest/BSimLaunchable.java#L572-L608","documentation":"Thrown by doGenerateSigs() when more than one positional argument is passed. The generatesigs command accepts at most one positional: an optional XML output directory. Two or more positional tokens after the ghidraURL indicate the user has misunderstood the command syntax. Note that concurrent --bsim/--config conflicts are already caught earlier in processSigAndUpdateOptions().","triggerScenarios":"Running generatesigs with two or more bare positional tokens, e.g. 'generatesigs <ghidraURL> dir1 dir2'. params.size() > 1 at line 589.","commonSituations":"Specifying both a source and output directory when only output is expected; passing a config template as a positional instead of via --config; a quoted path that the shell split into two tokens.","solutions":["Ensure at most one positional XML directory argument follows the ghidraURL.","Move any template specification to --config <template> rather than a bare positional.","Review the three valid generatesigs forms in printUsage() at lines 1033-1035."],"exampleFix":"// before\nbsim generatesigs ghidra://myhost/Repo /tmp/out medium_64\n// after\nbsim generatesigs ghidra://myhost/Repo /tmp/out --config medium_64","handlingStrategy":"validation","validationCode":"// For generatesigs: positional count must be 0 or 1\nif (\"generatesigs\".equals(command) && positionalParams.size() > 1) {\n    throw new IllegalArgumentException(\"generatesigs accepts at most one XML directory positional\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Separate positionals from options in a pre-parse pass to count them.","Use --config for the template instead of a bare positional."],"tags":["cli","argument-validation","bsim","generatesigs"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}