NationalSecurityAgency/ghidra · error · IllegalArgumentException
The --name, --arch, --compiler options are not valid when --
Error message
The --name, --arch, --compiler options are not valid when --md5 option is specified.
What it means
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.
Source
Thrown at Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/ingest/BSimLaunchable.java:724
private boolean isAllNull(String... strings) {
for (String s : strings) {
if (s != null) {
return false;
}
}
return true;
}
private void fillinSingleExeSpecifier(ExeSpecifier spec) throws IllegalArgumentException {
String md5Option = optionValueMap.get(MD5_OPTION);
String nameOption = optionValueMap.get(NAME_OPTION);
String archOption = optionValueMap.get(ARCH_OPTION);
String compOption = optionValueMap.get(COMPILER_OPTION);
if (md5Option != null) {
if (!isAllNull(nameOption, archOption, compOption)) {
throw new IllegalArgumentException(
"The " + NAME_OPTION + ", " + ARCH_OPTION + ", " + COMPILER_OPTION +
" options are not valid when " + MD5_OPTION + " option is specified.");
}
spec.exemd5 = md5Option;
}
else if (nameOption != null) {
spec.exename = nameOption;
spec.arch = archOption;
spec.execompname = compOption;
}
else {
throw new IllegalArgumentException(
"Must specify either " + MD5_OPTION + " or " + NAME_OPTION + " option");
}
}
private void doListFunctions(List<String> params) throws IOException, LSHException {
View on GitHub (pinned to d5f144c24d)
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.
Example fix
// before bsim listfuncs postgresql://myhost/BsimDB --md5 abc123 --name myexe // after (md5 lookup) bsim listfuncs postgresql://myhost/BsimDB --md5 abc123 // after (name lookup) bsim listfuncs postgresql://myhost/BsimDB --name myexe --arch x86:LE:64:default
Defensive patterns
Strategy: validation
Validate before calling
// Exe identification: md5 XOR (name + optional arch/compiler)
String md5 = optionValueMap.get("--md5");
String name = optionValueMap.get("--name");
String arch = optionValueMap.get("--arch");
String comp = optionValueMap.get("--compiler");
if (md5 != null && (name != null || arch != null || comp != null)) {
throw new IllegalArgumentException("--md5 cannot be combined with --name/--arch/--compiler");
} Type guard
// Sealed exe-identifier type (Java 16+)
sealed interface ExeId permits Md5Id, NameId {}
record Md5Id(String md5) implements ExeId {}
record NameId(String name, String arch, String compiler) implements ExeId {}
// Build via a factory that enforces mutual exclusivity at the type level Prevention
- Choose one identification scheme per invocation and never mix.
- In scripts, branch on whether you have an md5 before constructing args.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Invalid option use with --config option: --commit
- Invalid option use: --overwrite
- Unknown command: {}
- Unsupported command: {}
- Unsupported option use: {}
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/61dcbfcecc44f80f.
Report an issue: GitHub.