NationalSecurityAgency/ghidra · error · LSHException

ExeSpecifier must provide either md5 or name

Error message

ExeSpecifier must provide either md5 or name

What it means

`findSingleExecutable` requires at least one identifier on the ExeSpecifier. If both `exemd5` and `exename` are blank, it throws LSHException -- the lookup has no anchor to resolve an executable.

Source

Thrown at Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/client/AbstractSQLFunctionDatabase.java:1504

		for (ExecutableRow row : rows) {
			ExecutableRecord record = exeTable.makeExecutableRecord(manager, row);
			records.add(record);
		}
		return records;
	}

	private ExecutableRecord findSingleExecutable(ExeSpecifier spec, DescriptionManager manager)
			throws SQLException, LSHException {
		if (!StringUtils.isBlank(spec.exemd5)) {
			ExecutableRow row = exeTable.queryMd5ExeMatch(spec.exemd5);
			if (row == null) {
				return null;
			}
			return exeTable.makeExecutableRecord(manager, row);
		}
		if (StringUtils.isBlank(spec.exename)) {
			throw new LSHException("ExeSpecifier must provide either md5 or name");
		}
		return exeTable.querySingleExecutable(manager, spec.exename, spec.arch, spec.execompname);
	}

	private ExecutableRecord findSingleExeWithMap(ExeSpecifier exe, DescriptionManager manager,
			TreeMap<ExeSpecifier, ExecutableRecord> nameMap) throws SQLException, LSHException {
		ExecutableRecord erec = nameMap.get(exe);
		if (erec != null) {
			return erec;
		}
		erec = findSingleExecutable(exe, manager);
		nameMap.put(exe, erec);			// Cache ExecutableRecord in map, even if its null
		return erec;
	}

	/**
	 * Query for an executable via its md5 hash
	 * @param md5 is the 32-character md5 hash

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Populate at least one of exeMd5 or exeName on the ExeSpecifier.
  2. Validate the specifier before issuing the query.
  3. Prefer exeMd5 for unambiguous resolution.

Example fix

// before
ExeSpecifier spec = new ExeSpecifier();   // both blank -- throws
// after
ExeSpecifier spec = new ExeSpecifier();
spec.exename = "myapp";
spec.arch   = "x86:LE:64:default";
Defensive patterns

Strategy: validation

Validate before calling

// Require at least one identifier before querying.
if (StringUtils.isBlank(spec.exemd5) && StringUtils.isBlank(spec.exename)) {
    throw new IllegalArgumentException(
        "ExeSpecifier needs either exeMd5 or exeName");
}

Type guard

// isExeSpecifierResolvable: true iff the spec has at least one anchor.
static boolean isExeSpecifierResolvable(ExeSpecifier s) {
    return StringUtils.isNotBlank(s.exemd5) || StringUtils.isNotBlank(s.exename);
}

Try / catch

try {
    return db.findSingleExecutable(spec, manager);
} catch (LSHException e) {
    if (e.getMessage().equals("ExeSpecifier must provide either md5 or name")) {
        throw new IllegalArgumentException("Provide exeMd5 or exeName on the filter", e);
    }
    throw e;
}

Prevention

When it happens

Trigger: Constructing an ExeSpecifier and leaving both exeMd5 and exeName blank/empty, then passing it into a query path that calls findSingleExecutable.

Common situations: Programmatic ExeSpecifier construction with missing fields; deserialization gaps from a malformed request; filter-builder bugs that omit the identifier.

Related errors


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