NationalSecurityAgency/ghidra · error · IOException

Must specify "md5=" or "name="

Error message

Must specify "md5=" or "name="

What it means

Thrown by dumpSigs when both the md5 and name parameters are blank (null, empty, or whitespace). The method uses StringUtils.isAnyBlank on each parameter individually, and requires at least one to be non-blank to identify which executable to dump. Without either identifier the query has no target.

Source

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

			throw new LSHException(lastError.message);
		}
		resp.printRaw(outStream, querydb.getLSHVectorFactory(), 0);
	}

	/**
	 * Exports information about a binary to a local folder in XML format.
	 * 
	 * @param resultFolder the folder where the results will be stored
	 * @param md5 the MD5 of the executables to export
	 * @param name the name of the executables to export
	 * @throws IOException if there's an error establishing the database connection
	 * @throws LSHException if there's an error issuing the query
	 */
	public void dumpSigs(File resultFolder, String md5, String name)
			throws IOException, LSHException {

		if (StringUtils.isAnyBlank(md5) && StringUtils.isAnyBlank(name)) {
			throw new IOException("Must specify \"md5=\" or \"name=\"");
		}

		QueryName query = new QueryName();
		query.spec.exemd5 = md5;
		query.spec.exename = name;
		query.spec.arch = null;
		query.spec.execompname = null;

		doDumpSigs(resultFolder, query);
	}

	/**
	 * Exports information about a binary to a local folder in XML format.
	 * 
	 * @param resultFolder the folder where the results will be stored
	 * @param query the query object containing the params of the query
	 * @throws IOException if there's an error establishing the database connection
	 * @throws LSHException if there's an error issuing the query

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Provide at least one of md5 or name when calling dumpSigs — md5 is preferred as it is unambiguous.
  2. Validate inputs in the caller before invoking dumpSigs: require at least one non-blank.
  3. If calling from a script, ensure the --md5 or --name flag is passed.
  4. If you intended to dump all executables, note dumpSigs does not support that — use a different API.

Example fix

// before
if (StringUtils.isAnyBlank(md5) && StringUtils.isAnyBlank(name)) {
    throw new IOException("Must specify \"md5=\" or \"name=\"");
}

// after — validate in caller, fail with actionable guidance
if (StringUtils.isAnyBlank(md5) && StringUtils.isAnyBlank(name)) {
    throw new IOException("Must specify \"md5=\" or \"name=\". " +
        "Provide md5 for a unique match, or name (optionally with arch/compiler).");
}
Defensive patterns

Strategy: validation

Validate before calling

// Validate at least one identifier is provided before calling dumpSigs
if (StringUtils.isBlank(md5) && StringUtils.isBlank(name)) {
    throw new IllegalArgumentException(
        "At least one of md5 or name must be specified for dumpSigs");
}

Type guard

public static boolean hasDumpSigsIdentifier(String md5, String name) {
    return !StringUtils.isBlank(md5) || !StringUtils.isBlank(name);
}

Try / catch

// Validation-based — no try-catch needed if inputs are pre-validated.
// If defensive catch is required:
try {
    bulk.dumpSigs(resultFolder, md5, name);
} catch (IOException e) {
    if (e.getMessage().contains("Must specify")) {
        throw new IllegalArgumentException(e.getMessage(), e);
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling dumpSigs(resultFolder, null, null), dumpSigs(resultFolder, "", ""), or with both arguments as whitespace-only strings. The method checks isAnyBlank(md5) AND isAnyBlank(name), so both must be blank to trigger.

Common situations: A command-line tool or script passes null for both because the user omitted both flags; a caller extracts md5/name from metadata that was never populated; logic upstream computed an empty string due to a missing field in program metadata.

Related errors


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