{"record":{"id":"b40b7c2ad7fcb260","repo":"NationalSecurityAgency/ghidra","slug":"could-not-uniquely-match-executable-b40b7c","errorCode":null,"errorMessage":"Could not (uniquely) match executable","messagePattern":"Could not \\(uniquely\\) match executable","errorType":"exception","errorClass":"LSHException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/elastic/ElasticDatabase.java","lineNumber":3550,"sourceCode":"\t * @throws LSHException for problems adding records to the response\n\t * @throws ElasticException for communication problems with the server\n\t */\n\tprivate void fdbQueryChildren(QueryChildren query) throws LSHException, ElasticException {\n\t\tif (!info.trackcallgraph) {\n\t\t\tthrow new LSHException(\"Database does not track callgraph\");\n\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/**","sourceCodeStart":3532,"sourceCodeEnd":3568,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/elastic/ElasticDatabase.java#L3532-L3568","documentation":"Thrown by ElasticDatabase.fdbQueryChildren when findSingleExecutable returns null for the ExeSpecifier built from query.md5sum/name_exec/arch/name_compiler. findSingleExecutable returns null when zero OR more than one executable matches the specifier, hence '(uniquely)' in the message — the command requires exactly one match to resolve functions against.","triggerScenarios":"Submitting QueryChildren with an ExeSpecifier that matches no executable (wrong md5/name/arch/compiler) or matches multiple executables (ambiguous partial fields, e.g. same name+arch across two md5s).","commonSituations":"Typo or stale md5 in the query; leaving arch/compiler fields blank so several executables collide; querying after executables were merged/duplicated in the DB.","solutions":["Provide all four identifying fields (md5, name, arch, compiler) to make the match unique; md5 alone is usually sufficient.","If unsure which executable matches, first run a QueryName/exe-info query to enumerate candidates, then issue QueryChildren with the exact md5.","Deduplicate or reconcile executables in the database if a legitimate single binary appears twice."],"exampleFix":"// before\nquery.md5sum = md5;            // may be null/blank\nquery.name_exec = name;\n// after\nquery.md5sum = exactMd5;        // full 32-hex md5 uniquely identifies\nquery.name_exec = name;\nquery.arch = program.getLanguageID().toString();","handlingStrategy":"validation","validationCode":"// provide all fields; md5 makes the match unique\nExeSpecifier spec = new ExeSpecifier();\nspec.exemd5 = exactMd5;          // 32 hex chars\nspec.exename = name;\nspec.arch = arch;\nspec.execompname = compiler;\n// verify a unique match via QueryName before QueryChildren if unsure","typeGuard":"static boolean isFullySpecified(ExeSpecifier s) {\n    return s.exemd5 != null && s.exemd5.matches(\"[0-9a-fA-F]{32}\");\n}","tryCatchPattern":"try {\n    fdbQueryChildren(query);\n} catch (LSHException e) {\n    if (e.getMessage().startsWith(\"Could not (uniquely) match executable\")) {\n        // enumerate candidates and re-prompt the user to disambiguate\n    } else throw e;\n}","preventionTips":["Prefer md5 as the executable identifier to guarantee uniqueness.","Run an exe-info query first when fields are partial.","Avoid blank arch/compiler fields that cause collisions."],"tags":["bsim","elasticsearch","executable-resolution","ambiguous-match","command"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}