{"record":{"id":"61dcbfcecc44f80f","repo":"NationalSecurityAgency/ghidra","slug":"the-name-arch-compiler-options-are-not-val","errorCode":null,"errorMessage":"The --name, --arch, --compiler options are not valid when --md5 option is specified.","messagePattern":"The --name, --arch, --compiler options are not valid when --md5 option is specified\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/ingest/BSimLaunchable.java","lineNumber":724,"sourceCode":"\tprivate boolean isAllNull(String... strings) {\n\t\tfor (String s : strings) {\n\t\t\tif (s != null) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\n\tprivate void fillinSingleExeSpecifier(ExeSpecifier spec) throws IllegalArgumentException {\n\n\t\tString md5Option = optionValueMap.get(MD5_OPTION);\n\t\tString nameOption = optionValueMap.get(NAME_OPTION);\n\t\tString archOption = optionValueMap.get(ARCH_OPTION);\n\t\tString compOption = optionValueMap.get(COMPILER_OPTION);\n\n\t\tif (md5Option != null) {\n\t\t\tif (!isAllNull(nameOption, archOption, compOption)) {\n\t\t\t\tthrow new IllegalArgumentException(\n\t\t\t\t\t\"The \" + NAME_OPTION + \", \" + ARCH_OPTION + \", \" + COMPILER_OPTION +\n\t\t\t\t\t\t\" options are not valid when \" + MD5_OPTION + \" option is specified.\");\n\t\t\t}\n\t\t\tspec.exemd5 = md5Option;\n\t\t}\n\t\telse if (nameOption != null) {\n\t\t\tspec.exename = nameOption;\n\t\t\tspec.arch = archOption;\n\t\t\tspec.execompname = compOption;\n\t\t}\n\t\telse {\n\t\t\tthrow new IllegalArgumentException(\n\t\t\t\t\"Must specify either \" + MD5_OPTION + \" or \" + NAME_OPTION + \" option\");\n\t\t}\n\t}\n\n\tprivate void doListFunctions(List<String> params) throws IOException, LSHException {\n","sourceCodeStart":706,"sourceCodeEnd":742,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/ingest/BSimLaunchable.java#L706-L742","documentation":"Thrown by fillinSingleExeSpecifier() when --md5 is provided together with any of --name, --arch, or --compiler. BSim identifies an executable by EITHER an MD5 hash (--md5) OR a name+arch+compiler triple. Mixing the two identification schemes is contradictory and rejected. This affects listfuncs, delete, and dumpsigs which all call fillinSingleExeSpecifier.","triggerScenarios":"Running listfuncs/delete/dumpsigs with both --md5 <hash> and at least one of --name, --arch, --compiler. isAllNull(nameOption, archOption, compOption) returns false at line 723.","commonSituations":"Supplying a full set of identifiers 'just in case'; migrating a script from name-based to md5-based lookup and leaving the old flags; copy-pasting a command template.","solutions":["Remove --name, --arch, and --compiler if you are identifying the exe by --md5.","Or remove --md5 if you are identifying by name (with optional arch/compiler).","Decide on one identification scheme: md5-only OR name-with-arch-compiler."],"exampleFix":"// before\nbsim listfuncs postgresql://myhost/BsimDB --md5 abc123 --name myexe\n// after (md5 lookup)\nbsim listfuncs postgresql://myhost/BsimDB --md5 abc123\n// after (name lookup)\nbsim listfuncs postgresql://myhost/BsimDB --name myexe --arch x86:LE:64:default","handlingStrategy":"validation","validationCode":"// Exe identification: md5 XOR (name + optional arch/compiler)\nString md5 = optionValueMap.get(\"--md5\");\nString name = optionValueMap.get(\"--name\");\nString arch = optionValueMap.get(\"--arch\");\nString comp = optionValueMap.get(\"--compiler\");\nif (md5 != null && (name != null || arch != null || comp != null)) {\n    throw new IllegalArgumentException(\"--md5 cannot be combined with --name/--arch/--compiler\");\n}","typeGuard":"// Sealed exe-identifier type (Java 16+)\nsealed interface ExeId permits Md5Id, NameId {}\nrecord Md5Id(String md5) implements ExeId {}\nrecord NameId(String name, String arch, String compiler) implements ExeId {}\n// Build via a factory that enforces mutual exclusivity at the type level","tryCatchPattern":null,"preventionTips":["Choose one identification scheme per invocation and never mix.","In scripts, branch on whether you have an md5 before constructing args."],"tags":["cli","argument-validation","bsim","conflicting-options"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}