{"record":{"id":"09799121fa6217be","repo":"NationalSecurityAgency/ghidra","slug":"could-not-find-executable","errorCode":null,"errorMessage":"Could not find executable","messagePattern":"Could not find executable","errorType":"validation","errorClass":"LSHException","httpStatus":null,"severity":"warning","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/client/ExecutableComparison.java","lineNumber":172,"sourceCode":"\t * @param md5 is the md5 String\n\t * @return the corresponding ExecutableRecord\n\t * @throws LSHException if there are problems accessing the database\n\t *    or the executable doesn't exist\n\t */\n\tprivate ExecutableRecord lookupExecutable(String md5) throws LSHException {\n\t\tQueryName query = new QueryName();\n\t\tquery.spec = new ExeSpecifier();\n\t\tquery.spec.exemd5 = md5;\n\t\tquery.maxfunc = 1;\n\t\tquery.fillinCallgraph = false;\n\t\tquery.fillinCategories = false;\n\t\tquery.fillinSigs = false;\n\t\tResponseName response = query.execute(database);\n\t\tif (response == null) {\n\t\t\tthrow new LSHException(database.getLastError().message);\n\t\t}\n\t\tif (response.manage.numExecutables() != 1) {\n\t\t\tthrow new LSHException(\"Could not find executable\");\n\t\t}\n\t\treturn response.manage.getExecutableRecordSet().first();\n\t}\n\n\t/**\n\t * Query for all the vector ids associated with a specific executable.\n\t * Store them in the vectorMap\n\t * @param exeSpec indicates the specific executable\n\t * @param histogram is non-null, provide a histogram of the vector ids\n\t */\n\tprivate void pullVectorsForExe(ExeSpecifier exeSpec, Map<Long, Count> histogram) {\n\t\tQueryName queryName = new QueryName();\n\t\tqueryName.spec = exeSpec;\n\t\t// TODO: Need to make more of an effort to collect all vectors for large executables.\n\t\t// But, this requires a change to the QueryName API to allow a window to be specified\n\t\tqueryName.maxfunc = 100000;\n\t\tqueryName.fillinCallgraph = false;\n\t\tqueryName.fillinCategories = false;","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/client/ExecutableComparison.java#L154-L190","documentation":"Thrown by ExecutableComparison.lookupExecutable when a QueryName query succeeds (non-null response) but the result set does not contain exactly one executable (response.manage.numExecutables() != 1). Typically this means zero executables matched the given MD5 — the executable does not exist in the database.","triggerScenarios":"Looking up an MD5 that is not present in the BSim database; MD5 from a different database; executable was never ingested or was deleted; incorrect/typo MD5 string.","commonSituations":"Cross-referencing an MD5 against the wrong database; querying before ingestion completes; stale MD5 references; case-sensitivity or formatting mismatch in the MD5 string.","solutions":["Confirm the MD5 exists in the target database (query executable list or check ingestion).","Verify the MD5 string is correct and formatted as expected.","Ensure ingestion has completed before querying.","Handle the 'not found' case gracefully in the caller."],"exampleFix":"// before\nExecutableRecord rec = cmp.lookupExecutable(md5); // throws if absent\n// after\nResponseName resp = query.execute(database);\nif (resp == null || resp.manage.numExecutables() != 1) {\n    // handle not-found: skip or report\n    return null;\n}","handlingStrategy":"validation","validationCode":"// Pre-check existence:\nQueryExeInfo check = new QueryExeInfo(0, md5, null, null, null, null, false);\nResponseExe r = check.execute(database);\nif (r == null || r.records.isEmpty()) {\n    // MD5 not in DB; skip lookup\n}","typeGuard":null,"tryCatchPattern":"catch (LSHException e) { if (e.getMessage().contains(\"Could not find executable\")) { /* handle missing MD5 gracefully */ } }","preventionTips":["Pre-validate that the MD5 is ingested before comparison.","Treat 'not found' as an expected case, not an exceptional one, in batch flows."],"tags":["bsim","data","not-found"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}