{"record":{"id":"cd2111decc2ac99c","repo":"NationalSecurityAgency/ghidra","slug":"could-not-resolve-filter-specifying-function-cd2111","errorCode":null,"errorMessage":"Could not resolve filter specifying function: [","messagePattern":"Could not resolve filter specifying function: \\[","errorType":"exception","errorClass":"ElasticException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/elastic/ElasticDatabase.java","lineNumber":2690,"sourceCode":"\t * These 3 Strings are designed to uniquely identify a library function.\n\t * @param exeName is the name of the executable\n\t * @param funcName is the name of the function\n\t * @param arch is the executable architecture\n\t * @return the document id of the matching function\n\t * @throws ElasticException if the function (the executable) doesn't exist\n\t */\n\tpublic String recoverExternalFunctionId(String exeName, String funcName, String arch)\n\t\t\tthrows ElasticException {\n\t\tString md5 = ExecutableRecord.calcLibraryMd5Placeholder(exeName, arch);\n\t\tJsonObject row = queryMd5ExeMatch(md5);\n\t\tif (row == null) {\n\t\t\tthrow new ElasticException(\n\t\t\t\t\"Could not resolve filter specifying executable: \" + exeName);\n\t\t}\n\t\tString exeId = row.get(\"_id\").getAsString();\n\t\tJsonArray descres = queryFuncNameMatch(exeId, funcName, 2);\n\t\tif (1 != descres.size()) {\n\t\t\tthrow new ElasticException(\n\t\t\t\t\"Could not resolve filter specifying function: [\" + exeName + \"]\" + funcName);\n\t\t}\n\t\tRowKeyElastic eKey = RowKeyElastic.parseExeIdString(exeId);\n\t\tStringBuilder buffer = new StringBuilder();\n\t\teKey.generateLibraryFunctionId(buffer, funcName);\n\t\treturn buffer.toString();\n\t}\n\n\t/**\n\t * For every function currently in the manager, fill in its call-graph information.\n\t * This involves querying the database for child information, adding the cross-link\n\t * information (CallgraphEntry) between FunctionDescriptions, and possibly querying\n\t * for new library executables and functions\n\t * @param manager is the collection of functions to link\n\t * @throws LSHException for problems updating the container\n\t * @throws ElasticException for communication problems with the server\n\t */\n\tprivate void queryCallgraph(DescriptionManager manager) throws LSHException, ElasticException {","sourceCodeStart":2672,"sourceCodeEnd":2708,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/elastic/ElasticDatabase.java#L2672-L2708","documentation":"Thrown in recoverExternalFunctionId when queryFuncNameMatch returns a result set whose size is not exactly 1. A size of 0 means no function with the given name exists in the executable; a size of 2 (the query max) means the function name is ambiguous — multiple functions in the same executable share that name.","triggerScenarios":"After the executable is found (exeId resolved), queryFuncNameMatch(exeId, funcName, 2) is issued. If the result array size is not 1 (either 0 or 2), the exception is thrown with the exeName and funcName in the message.","commonSituations":"Typo in the function name; function was renamed or does not exist in the library version that was ingested; duplicate function names within the same executable from symbol collisions, overloaded C++ functions, or weak symbols.","solutions":["Verify the funcName is spelled correctly and exists in the specified library executable.","If duplicates exist (size > 1), disambiguate by using a function address or a more specific identifier instead of the name.","Re-ingest the library with unique function names if symbol collisions are the cause.","Query the executable index for name_func to list all function names in that executable and confirm uniqueness."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Verify the function exists and is unique before calling recoverExternalFunctionId\nString md5 = ExecutableRecord.calcLibraryMd5Placeholder(exeName, arch);\nJsonObject exeRow = queryMd5ExeMatch(md5);\nif (exeRow == null) return; // handled by 877\nString exeId = exeRow.get(\"_id\").getAsString();\nJsonArray funcs = queryFuncNameMatch(exeId, funcName, 2);\nif (funcs.size() == 0) {\n    throw new IllegalArgumentException(\"Function '\" + funcName + \"' not found in \" + exeName);\n}\nif (funcs.size() > 1) {\n    throw new IllegalArgumentException(\"Function name '\" + funcName + \"' is ambiguous in \" + exeName);\n}","typeGuard":null,"tryCatchPattern":"try {\n    String funcId = database.recoverExternalFunctionId(exeName, funcName, arch);\n} catch (ElasticException e) {\n    if (e.getMessage().contains(\"Could not resolve filter specifying function\")) {\n        Msg.warn(this, \"Function not found or ambiguous: [\" + exeName + \"]\" + funcName);\n        // Check spelling or disambiguate by address\n    }\n    throw e;\n}","preventionTips":["Verify function names are spelled correctly and exist in the target library executable.","If function names are ambiguous, use function addresses or more specific identifiers.","When ingesting libraries with potential symbol collisions, normalize function names to ensure uniqueness."],"tags":["bsim","library","query","ambiguous","filter","external-function","duplicate-name"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}