{"record":{"id":"0e5a52a1c78e664e","repo":"NationalSecurityAgency/ghidra","slug":"could-not-perform-delete","errorCode":null,"errorMessage":"Could not perform delete: {}","messagePattern":"Could not perform delete: (.+?)","errorType":"exception","errorClass":"LSHException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/ingest/BulkSignatures.java","lineNumber":572,"sourceCode":"\t\tdeleteExecutables(spec);\n\t}\n\n\t/**\n\t * Deletes a specified executable from the database.\n\t * \n\t * @param spec the spec that indicates what executable to delete\n\t * @throws IOException if there's an error establishing the database connection\n\t * @throws LSHException if there's an error issuing the query\n\t */\n\tprotected void deleteExecutables(ExeSpecifier spec) throws IOException, LSHException {\n\n\t\tQueryDelete query = new QueryDelete();\n\t\tquery.addSpecifier(spec);\n\t\testablishQueryServerConnection(true);\n\t\tResponseDelete respdel = query.execute(querydb);\n\t\tif (respdel == null) {\n\t\t\tBSimError lastError = querydb.getLastError();\n\t\t\tthrow new LSHException(\"Could not perform delete: \" + lastError.message);\n\t\t}\n\n\t\t// TODO: Should this output differ for command-line vs workbench? debug only?\n\t\tfor (DeleteResult delres : respdel.reslist) {\n\t\t\tMsg.info(this, \"Successfully deleted \" + delres.name + \"(\" +\n\t\t\t\tInteger.toString(delres.funccount) + \" functions)\" + delres.md5);\n\t\t}\n\t\tfor (ExeSpecifier missedSpec : respdel.missedlist) {\n\t\t\tMsg.error(this, \"Unable to uniquely identify: \" + missedSpec.getExeNameWithMD5());\n\t\t}\n\t}\n\n\t/**\n\t * Drops the current BSim database index which can allow for faster signature ingest after\n\t * which a {@link #rebuildIndex()} may be performed.  Dropping the index may also be done to\n\t * obtain more accurate results albeit at the cost of performance.\n\t * \n\t * @throws IOException if there's an error establishing the database connection","sourceCodeStart":554,"sourceCodeEnd":590,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/ingest/BulkSignatures.java#L554-L590","documentation":"Thrown in deleteExecutables when QueryDelete.execute(querydb) returns null, meaning the server could not perform the delete. BulkSignatures rethrows the last error message as an LSHException prefixed 'Could not perform delete:'. Unlike the Format/Nonfatal handling elsewhere, here any null response is fatal.","triggerScenarios":"Deleting an executable whose specifier the server cannot resolve, a connection drop during the delete, insufficient privileges, or a backend error.","commonSituations":"md5/name do not match any stored executable (server still returns null on total miss in some backends); permissions; transient connection loss; DB in read-only mode.","solutions":["Read the LSHException message for the server's reason.","Confirm the executable (md5/name) exists via getexeinfo before deleting.","Verify the connecting user has delete privileges.","Retry once if the message indicates a transient connection issue."],"exampleFix":"// before\nbsim.deleteExecutable(md5, null);  // md5 not in DB -> LSHException\n\n// after\n// verify the exe exists first, then delete\nif (!bsim.getExecutableRecords(1, md5, null, null, null, false).isEmpty()) {\n    bsim.deleteExecutable(md5, null);\n}","handlingStrategy":"validation","validationCode":"// confirm the executable exists before deleting\nif (bsim.getExecutableRecords(1, md5, name, null, null, null, false).isEmpty()) {\n    throw new NoSuchElementException(\"No executable for md5/name\");\n}\nbsim.deleteExecutable(md5, name);","typeGuard":null,"tryCatchPattern":"try {\n    bsim.deleteExecutable(md5, name);\n} catch (LSHException e) {\n    // message: \"Could not perform delete: <server>\"; verify existence/privileges and retry if transient\n}","preventionTips":["Verify the executable exists (getexeinfo) before deleting.","Ensure delete privileges on the connecting user.","Retry once on transient connection failures."],"tags":["bsim","delete","lshexception"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}