NationalSecurityAgency/ghidra · error · IllegalArgumentException

Must specify either --md5 or --name option

Error message

Must specify either --md5 or --name option

What it means

Thrown by fillinSingleExeSpecifier() when neither --md5 nor --name is supplied to listfuncs, delete, or dumpsigs. At least one executable identifier is required to know which exe's functions/records to operate on. --arch and --compiler alone are insufficient because they refine a name, not identify an exe independently.

Source

Thrown at Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/ingest/BSimLaunchable.java:736

		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 {

		Integer maxFunc = parsePositiveIntegerOption(MAX_FUNC_OPTION);

		QueryName query = new QueryName();
		fillinSingleExeSpecifier(query.spec);

		if (maxFunc != null) {
			query.maxfunc = maxFunc;
		}
		if (booleanOptions.contains(PRINT_SELF_SIGNIFICANCE_OPTION)) {
			query.printselfsig = true;
		}
		if (booleanOptions.contains(CALL_GRAPH_OPTION)) {

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Add --md5 <hash> OR --name <exe_name> to the command.
  2. If using --name, you may also add --arch <languageID> and --compiler <cspecID> for precision.
  3. Review usage at line 1044 (listfuncs) or 1045 (dumpsigs) or 1043 (delete).

Example fix

// before
bsim listfuncs postgresql://myhost/BsimDB
// after
bsim listfuncs postgresql://myhost/BsimDB --name myexe
Defensive patterns

Strategy: validation

Validate before calling

// At least one of --md5 or --name is required for exe-targeting commands
String md5 = optionValueMap.get("--md5");
String name = optionValueMap.get("--name");
if (md5 == null && name == null) {
    throw new IllegalArgumentException("Specify --md5 <hash> or --name <exe> to identify the executable");
}

Prevention

When it happens

Trigger: Running listfuncs/delete/dumpsigs with neither --md5 nor --name. md5Option is null and nameOption is null at line 722/730, falling through to the else at line 735.

Common situations: Forgetting the identifier entirely; supplying only --arch/--compiler (which are qualifiers, not identifiers); assuming the tool lists all functions with no filter.

Related errors


AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14). Data as JSON: /api/errors/aa76df21e29b7ad1. Report an issue: GitHub.