{"record":{"id":"5555e1e8342ce240","repo":"NationalSecurityAgency/ghidra","slug":"could-not-find-function-funcname","errorCode":null,"errorMessage":"Could not find function: ${funcName}","messagePattern":"Could not find function: (.+?)","errorType":"exception","errorClass":"LSHException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/elastic/ElasticDatabase.java","lineNumber":3556,"sourceCode":"\t\t}\n\t\tResponseChildren response = query.childrenresponse;\n\t\tExecutableRecord exe = null;\n\n\t\tExeSpecifier exeSpec = new ExeSpecifier();\n\t\texeSpec.exemd5 = query.md5sum;\n\t\texeSpec.exename = query.name_exec;\n\t\texeSpec.arch = query.arch;\n\t\texeSpec.execompname = query.name_compiler;\n\n\t\texe = findSingleExecutable(exeSpec, response.manage);\n\t\tif (exe == null) {\n\t\t\tthrow new LSHException(\"Could not (uniquely) match executable\");\n\t\t}\n\t\tfor (FunctionEntry entry : query.functionKeys) {\n\t\t\tFunctionDescription func =\n\t\t\t\tqueryByNameAddress(response.manage, exe, entry.funcName, entry.address, true);\n\t\t\tif (func == null) {\n\t\t\t\tthrow new LSHException(\"Could not find function: \" + entry.funcName);\n\t\t\t}\n\t\t\tresponse.correspond.add(func);\n\t\t}\n\n\t\tTreeMap<RowKey, FunctionDescription> funcmap = new TreeMap<>();\n\t\tresponse.manage.generateFunctionIdMap(funcmap);\n\t\tfor (FunctionDescription element : response.correspond) {\n\t\t\tfillinChildren(element, response.manage, funcmap);\n\t\t}\n\t}\n\n\t/**\n\t * Entry point for the Elasticsearch version of QueryInfo command:\n\t *   Query for basic information about a database\n\t * @param query is command parameters\n\t */\n\tprivate void fdbDatabaseInfo(QueryInfo query) {\n\t\tfinal ResponseInfo response = query.inforesponse;","sourceCodeStart":3538,"sourceCodeEnd":3574,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/elastic/ElasticDatabase.java#L3538-L3574","documentation":"Thrown by ElasticDatabase.fdbQueryChildren when, after uniquely resolving the executable, queryByNameAddress returns null for one of the query.functionKeys (funcName + address). The executable matched but the named function at that address does not exist in the BSim index for that executable.","triggerScenarios":"QueryChildren whose functionKeys reference a function name/address that was never ingested, was renamed, or whose address shifted (rebase) relative to what was indexed.","commonSituations":"Program was modified (functions renamed/added) after the executable was ingested into BSim; address passed is post-relocation but the DB stored the original; querying a function that BSim's ingest skipped (e.g. thunk/external).","solutions":["Re-ingest the executable so its function set and addresses match the current program.","Verify the entry.address matches the address space used at ingest (check for rebase) and the entry.funcName spelling exactly.","List functions for the executable first (QueryName) to confirm the function exists before issuing QueryChildren."],"exampleFix":"// before\nentry.funcName = sym.getName(true);\nentry.address = addr;   // possibly rebased\n// after\nentry.funcName = sym.getName(true);\nentry.address = program.getImageBase().add(addr.subtract(rebasedAddr));","handlingStrategy":"validation","validationCode":"// confirm the function exists in the indexed set before QueryChildren\nExecutableRecord exe = findSingleExecutable(spec, manager);\nif (!exe.containsFunction(entry.funcName, entry.address)) {\n    // re-ingest or correct the address\n}","typeGuard":null,"tryCatchPattern":"try {\n    fdbQueryChildren(query);\n} catch (LSHException e) {\n    if (e.getMessage().startsWith(\"Could not find function:\")) {\n        // re-ingest executable or correct address/name\n    } else throw e;\n}","preventionTips":["Re-ingest after significant program changes so names/addresses match.","Pass addresses in the same address space used at ingest (watch for rebases).","List functions (QueryName) to confirm existence before issuing QueryChildren."],"tags":["bsim","elasticsearch","function-resolution","not-found","callgraph"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}