{"record":{"id":"fe8e5503977fb4be","repo":"NationalSecurityAgency/ghidra","slug":"unable-to-drop-database","errorCode":null,"errorMessage":"Unable to drop database: {}","messagePattern":"Unable to drop database: (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/ingest/BulkSignatures.java","lineNumber":466,"sourceCode":"\t\tboolean success = querydb.initialize();\n\t\tif (!success) {\n\t\t\tMsg.error(this, \"Database initialization error: \" + querydb.getLastError().message);\n\t\t}\n\t}\n\n\t/**\n\t * Drops the current BSim database.\n\t * \n\t * @throws IOException if there's an error establishing the database connection\n\t */\n\tpublic void dropDatabase() throws IOException {\n\t\testablishQueryServerConnection(false); // Set up client configuration\n\t\tquerydb.close(); // Database can't be in use when we try to drop it\n\t\tDropDatabase command = new DropDatabase();\n\t\tcommand.databaseName = bsimServerInfo.getDBName();\n\t\tResponseDropDatabase response = command.execute(querydb);\n\t\tif (response == null) {\n\t\t\tthrow new IOException(\"Unable to drop database: \" + querydb.getLastError().message);\n\t\t}\n\t\tif (response.dropSuccessful) {\n\t\t\tMsg.info(this, \"Successfully dropped database \\\"\" + command.databaseName + \"\\\"\");\n\t\t}\n\t\telse {\n\t\t\tMsg.error(this, \"Unable to drop database: \" + response.errorMessage);\n\t\t}\n\t}\n\n\t/**\n\t * Adds function signatures from the specified project to the BSim database\n\t * @param ghidraURL ghidra repository from which to pull files for signature generation\n\t * @param sigsLocation the location where signature files will be stored\n\t * @param overwrite if true, overwrites any existing signatures\n\t * @param monitor the task monitor\n\t * @throws Exception if there's an error during the operation\n\t * @throws CancelledException if processing is cancelled\n\t */","sourceCodeStart":448,"sourceCodeEnd":484,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/ingest/BulkSignatures.java#L448-L484","documentation":"Thrown in BulkSignatures.dropDatabase when ResponseDropDatabase response is null, i.e. the server rejected the DropDatabase command. BulkSignatures wraps the server's BSimError message into 'Unable to drop database: <message>'. Note this covers the protocol-level null response; a non-null but unsuccessful response is handled separately as a logged error rather than a throw.","triggerScenarios":"Calling dropDatabase when the server refuses: database does not exist, the client has no drop permission, the database is in use by another connection, or a backend error.","commonSituations":"Dropping a name that was never created or already dropped; another active client holds the database open; operator lacks drop privileges.","solutions":["Read the message to get the server's reason (nonexistent vs. in-use vs. permission).","Ensure no other client/connection is using the database, then retry.","Confirm the connecting user has drop privileges on the backend.","Verify the database name matches an existing one."],"exampleFix":"// before\nbsim.dropDatabase();  // in-use -> IOException\n\n// after\n// close other connections to the DB, then retry\nbsim.dropDatabase();","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    bsim.dropDatabase();\n} catch (IOException e) {\n    String m = e.getMessage();\n    if (m.contains(\"does not exist\")) { /* already gone; ignore */ }\n    else if (m.contains(\"in use\") || m.contains(\"is being used\")) {\n        // close other connections and retry\n    } else { throw e; }\n}","preventionTips":["Ensure no other client holds the database open before dropping.","Verify the database name exists before dropping.","Confirm drop privileges on the backend."],"tags":["bsim","database-drop","in-use","ioexception"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}