NationalSecurityAgency/ghidra · error · LSHException

Unable to find FunctionDescription

Error message

Unable to find FunctionDescription

What it means

Thrown by DescriptionManager.findFunction(String fname, long address, ExecutableRecord exe) when the function description keyed by (name, address, parent executable) is not present. It constructs a FunctionDescription template and uses funcrec.floor(); if the floor is null or not equal to the template, no matching function exists.

Source

Thrown at Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/description/DescriptionManager.java:442

		throw new LSHException("Unable to find executable");
	}

	/**
	 * Find a function (within an executable) by its name and address (both must be provided)
	 * If the request function does not exist, an exception is thrown
	 * @param fname - the name of the function
	 * @param address - the address of the function
	 * @param exe - the ExecutableRecord containing the function
	 * @return the FunctionDescription
	 * @throws LSHException if a matching function does not exist
	 */
	public FunctionDescription findFunction(String fname, long address, ExecutableRecord exe)
			throws LSHException {
		FunctionDescription fdesc = new FunctionDescription(exe, fname, address);

		FunctionDescription res = funcrec.floor(fdesc);
		if (res == null || (!res.equals(fdesc))) {
			throw new LSHException("Unable to find FunctionDescription");
		}
		return res;
	}

	/**
	 * Find a function within an executable by name. The name isn't guaranteed to be unique. If there
	 * are more than one, the first in address order is returned. If none are found, null is returned
	 * @param fname is the name of the function to match
	 * @param exe is the ExecutableRecord containing the function
	 * @return a FunctionDescription or null 
	 */
	public FunctionDescription findFunctionByName(String fname, ExecutableRecord exe) {
		FunctionDescription fdesc = new FunctionDescription(exe, fname, 0);
		FunctionDescription res = funcrec.ceiling(fdesc);
		if (res == null || !fname.equals(res.getFunctionName()) ||
			!res.getExecutableRecord().equals(exe)) {
			return null;
		}

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Insert the FunctionDescription (via newFunction) before calling findFunction.
  2. Confirm the address long matches the entry-point address stored at insert time.
  3. Verify the ExecutableRecord passed is the same instance that owns the function.
  4. Catch LSHException and fall back to findFunctionByName if address is uncertain.

Example fix

// before
FunctionDescription f = man.findFunction(fname, address, exe); // throws

// after
FunctionDescription f = man.findFunctionByName(fname, exe); // null-tolerant fallback
Defensive patterns

Strategy: try-catch

Try / catch

try {
    return man.findFunction(fname, address, exe);
} catch (LSHException e) {
    return man.findFunctionByName(fname, exe); // null-tolerant
}

Prevention

When it happens

Trigger: Calling findFunction(fname, address, exe) where exe has no FunctionDescription with both the given name and address. Reached during query result resolution or XML restore when a referenced function has not been inserted.

Common situations: Looking up a function before inserting it; address computed in the wrong address space/offset; name normalized differently (demangled vs mangled); referencing a function from a different executable record; executable record mismatch (right name, wrong exe object).

Related errors


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