{"record":{"id":"d457e8a517a14df6","repo":"NationalSecurityAgency/ghidra","slug":"executable","errorCode":null,"errorMessage":"Executable ","messagePattern":"Executable ","errorType":"exception","errorClass":"InvalidParameterException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/ghidra_scripts/CompareExecutablesScript.java","lineNumber":70,"sourceCode":"\tprivate ExecutableComparison exeCompare;\n\n\t@Override\n\tprotected void run() throws Exception {\n\t\tString urlString = askString(\"Enter BSim database URL\", \"URL: \");\n\t\tString execName =\n\t\t\taskString(\"Enter name of executable to compare against database\", \"Name: \");\n\t\tURL url = BSimClientFactory.deriveBSimURL(urlString);\n\t\ttry (FunctionDatabase database = BSimClientFactory.buildClient(url, true)) {\n\t\t\tQueryExeInfo exeInfo = new QueryExeInfo();\n\t\t\texeInfo.filterExeName = execName;\n\t\t\tResponseExe exeResult = exeInfo.execute(database);\n\t\t\tif (exeResult == null) {\n\t\t\t\tString message = database.getLastError() != null ? database.getLastError().message\n\t\t\t\t\t\t: \"Unrecoverable error\";\n\t\t\t\tthrow new IOException(message);\n\t\t\t}\n\t\t\telse if (exeResult.recordCount == 0) {\n\t\t\t\tthrow new InvalidParameterException(\n\t\t\t\t\t\"Executable \" + execName + \" is not present in database\");\n\t\t\t}\n\t\t\telse if (exeResult.recordCount > 1) {\n\t\t\t\tprintln(\"Multiple executables with the name - \" + execName);\n\t\t\t\tExecutableRecord exeRecord = exeResult.records.get(0);\n\t\t\t\tprint(\"Using \");\n\t\t\t\tprintln(exeRecord.printRaw());\n\t\t\t}\n\t\t\tString baseMd5 = exeResult.records.get(0).getMd5();\n\n\t\t\tScoreCaching cache = null;\t\t// If null, self scores will not be cached\n\n\t\t\t// Scores can be cached in the local file system by using FileScoreCaching\n\t\t\t// cache = new FileScoreCaching(\"/tmp/test_scorecacher.txt\");\n\n\t\t\t// Scores can be cached in a dedicated table within the database by using TableScoreCaching\n\t\t\t// TableScoreCaching is currently only supported for the PostgreSQL back-end.\n\t\t\t// cache = new TableScoreCaching(database);","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/ghidra_scripts/CompareExecutablesScript.java#L52-L88","documentation":"CompareExecutablesScript queries the BSim database for an executable by name; if exeResult.recordCount is 0 it throws InvalidParameterException indicating the named executable is not present. This is a user-input validation error: the executable name provided via askString does not match any record in the target BSim database.","triggerScenarios":"Running CompareExecutablesScript, providing an execName (via askString) and a database URL; QueryExeInfo.execute(database) returns a ResponseExe with recordCount == 0. The name filter matched no executable records.","commonSituations":"Typo in the executable name; the executable was never ingested into this BSim database; the wrong BSim server/database URL was specified; the executable was ingested under a different name (full path vs. basename mismatch); case sensitivity in the name filter.","solutions":["Verify the executable name spelling and case against the BSim database contents (query exe info without a filter to list available executables).","Confirm the correct BSim server URL was provided — the executable may exist in a different repository.","Run GenerateSignatures/ingestion for the target executable first to populate the database.","Check whether the database stores full paths vs. basenames and adjust the queried name accordingly."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Before throwing, query available executables to validate the name\nQueryExeInfo check = new QueryExeInfo();\ncheck.filterExeName = null; // list all\nResponseExe all = check.execute(database);\nboolean exists = all.records.stream()\n    .anyMatch(r -> r.getName().equals(execName));\nif (!exists) {\n    // prompt user to pick from available names\n}","typeGuard":null,"tryCatchPattern":"try {\n    // run comparison\n} catch (InvalidParameterException e) {\n    if (e.getMessage().contains(\"is not present in database\")) {\n        // re-prompt user with a list of available executables\n    } else {\n        throw e;\n    }\n}","preventionTips":["Present a dropdown of available executable names from the BSim DB instead of free-text input.","Strip path components from the name to match how BSim stores it (basename only).","Validate the executable name against the DB before starting the comparison workflow."],"tags":["bsim","executable-lookup","user-input","validation"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}