NationalSecurityAgency/ghidra · warning · FunctionComparisonException
Couldn't get local function {} at {}.
Error message
Couldn't get local function {} at {}. What it means
BSimSearchResultsProvider.getOriginalFunction() looks up the local program's function at the match result's entry point address. If FunctionManager.getFunctionAt(originalEntryPoint) returns null it throws FunctionComparisonException. This means a BSim match result references a function entry point that no longer exists in the currently loaded local program.
Source
Thrown at Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/gui/search/results/BSimSearchResultsProvider.java:521
int rowCount = model.getRowCount();
String text = title + " - " + rowCount + " results";
int nonFilteredSize = nonFilteredRowCount.getAsInt();
if (nonFilteredSize != rowCount) {
text += " (Filtered from " + nonFilteredSize + " results)";
}
titleLabel.setText(text);
});
return panel;
}
private Function getOriginalFunction(BSimMatchResult resultRow)
throws FunctionComparisonException {
// Determine the original function (local program's function; left side)
Address originalEntryPoint = resultRow.getAddress();
FunctionManager originalFunctionManager = program.getFunctionManager();
Function originalFunction = originalFunctionManager.getFunctionAt(originalEntryPoint);
if (originalFunction == null) {
throw new FunctionComparisonException("Couldn't get local function " +
resultRow.getOriginalFunctionDescription().getFunctionName() + " at " +
originalEntryPoint.toString() + ".");
}
return originalFunction;
}
private Function getMatchFunction(BSimMatchResult resultRow, Set<Program> opened)
throws FunctionComparisonException {
// Determine the match function (remote program's function; right side)
Program matchProgram = getCachedRemoteProgram(resultRow.getExecutableURLString(), opened);
if (matchProgram == null) {
throw new FunctionComparisonException(
"Couldn't open remote program: " + resultRow.getExecutableURLString() + " for " +
resultRow.getSimilarFunctionName() + ".");
}
FunctionDescription matchFunctionDescription = resultRow.getMatchFunctionDescription();
long matchOffset = matchFunctionDescription.getAddress();
Address matchEntryPoint =View on GitHub (pinned to d5f144c24d)
Solutions
- Re-run the BSim search against the current program state so match results reflect existing function entry points.
- Verify the program hasn't been modified (functions deleted/moved) since the BSim signatures were generated.
- Clear the BSim search results cache and re-query if results appear stale.
- Regenerate signatures for the current program and re-ingest into BSim.
Defensive patterns
Strategy: validation
Validate before calling
// Verify the function still exists before opening comparison
FunctionManager fm = program.getFunctionManager();
for (BSimMatchResult row : results) {
if (fm.getFunctionAt(row.getAddress()) == null) {
// mark row as stale / remove from results
}
} Try / catch
try {
getOriginalFunction(resultRow);
} catch (FunctionComparisonException e) {
if (e.getMessage().startsWith("Couldn't get local function")) {
// skip this match row — local function no longer exists
} else {
throw e;
}
} Prevention
- Re-run BSim searches after significant program modifications.
- Filter match results against the current function set before presenting comparison options.
- Regenerate signatures if the program's function layout changes.
- Avoid deleting/moving functions between BSim search and comparison.
When it happens
Trigger: Calling getOriginalFunction(resultRow) during a BSim comparison action where program.getFunctionManager().getFunctionAt(resultRow.getAddress()) returns null. The entry point stored in the BSim match doesn't correspond to a function in the live program.
Common situations: The program was modified after the BSim search index was built (functions deleted, moved, or re-analyzed with different entry points); the program was re-analyzed changing function boundaries; the match result is stale (from a cached/old search); the program loaded for comparison is a different version than the one indexed.
Related errors
- Couldn't get remote function {} at {}.
- Couldn't open remote program: {} for {}.
- {getType()}scripts cannot be used for context [{context.name
- Unknown script name {scriptSource}
- Document is missing "features"
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/5dc6f08371d69b3f.
Report an issue: GitHub.