{"record":{"id":"5dc6f08371d69b3f","repo":"NationalSecurityAgency/ghidra","slug":"couldn-t-get-local-function-at","errorCode":null,"errorMessage":"Couldn't get local function {} at {}.","messagePattern":"Couldn't get local function (.+?) at (.+?)\\.","errorType":"exception","errorClass":"FunctionComparisonException","httpStatus":null,"severity":"warning","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/gui/search/results/BSimSearchResultsProvider.java","lineNumber":521,"sourceCode":"\t\t\tint rowCount = model.getRowCount();\n\t\t\tString text = title + \"  - \" + rowCount + \" results\";\n\t\t\tint nonFilteredSize = nonFilteredRowCount.getAsInt();\n\t\t\tif (nonFilteredSize != rowCount) {\n\t\t\t\ttext += \"   (Filtered from \" + nonFilteredSize + \" results)\";\n\t\t\t}\n\t\t\ttitleLabel.setText(text);\n\t\t});\n\t\treturn panel;\n\t}\n\n\tprivate Function getOriginalFunction(BSimMatchResult resultRow)\n\t\t\tthrows FunctionComparisonException {\n\t\t// Determine the original function (local program's function; left side)\n\t\tAddress originalEntryPoint = resultRow.getAddress();\n\t\tFunctionManager originalFunctionManager = program.getFunctionManager();\n\t\tFunction originalFunction = originalFunctionManager.getFunctionAt(originalEntryPoint);\n\t\tif (originalFunction == null) {\n\t\t\tthrow new FunctionComparisonException(\"Couldn't get local function \" +\n\t\t\t\tresultRow.getOriginalFunctionDescription().getFunctionName() + \" at \" +\n\t\t\t\toriginalEntryPoint.toString() + \".\");\n\t\t}\n\t\treturn originalFunction;\n\t}\n\n\tprivate Function getMatchFunction(BSimMatchResult resultRow, Set<Program> opened)\n\t\t\tthrows FunctionComparisonException {\n\t\t// Determine the match function (remote program's function; right side)\n\t\tProgram matchProgram = getCachedRemoteProgram(resultRow.getExecutableURLString(), opened);\n\t\tif (matchProgram == null) {\n\t\t\tthrow new FunctionComparisonException(\n\t\t\t\t\"Couldn't open remote program: \" + resultRow.getExecutableURLString() + \" for \" +\n\t\t\t\t\tresultRow.getSimilarFunctionName() + \".\");\n\t\t}\n\t\tFunctionDescription matchFunctionDescription = resultRow.getMatchFunctionDescription();\n\t\tlong matchOffset = matchFunctionDescription.getAddress();\n\t\tAddress matchEntryPoint =","sourceCodeStart":503,"sourceCodeEnd":539,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/gui/search/results/BSimSearchResultsProvider.java#L503-L539","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Verify the function still exists before opening comparison\nFunctionManager fm = program.getFunctionManager();\nfor (BSimMatchResult row : results) {\n    if (fm.getFunctionAt(row.getAddress()) == null) {\n        // mark row as stale / remove from results\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    getOriginalFunction(resultRow);\n} catch (FunctionComparisonException e) {\n    if (e.getMessage().startsWith(\"Couldn't get local function\")) {\n        // skip this match row — local function no longer exists\n    } else {\n        throw e;\n    }\n}","preventionTips":["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."],"tags":["bsim","function-comparison","stale-data","program-modification"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}