NationalSecurityAgency/ghidra · error · UnsupportedOperationException

drop database name must match

Error message

drop database name must match

What it means

Thrown by fdbDatabaseDrop when processing a DropDatabase query whose databaseName field does not equal the name of the database the connection (ds.getServerInfo().getDBName()) is currently pointed at. BSim refuses to drop a database with a mismatched name to prevent accidental deletion of a different database than the one the client is connected to.

Source

Thrown at Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/client/AbstractSQLFunctionDatabase.java:2106

				throw new LSHException("Could not find function: " + entry.funcName);
			}
			response.correspond.add(func);
		}

		TreeMap<RowKey, FunctionDescription> funcmap = new TreeMap<>();
		response.manage.generateFunctionIdMap(funcmap);
		for (FunctionDescription element : response.correspond) {
			fillinChildren(element, response.manage, funcmap);
		}
	}

	private void fdbDatabaseDrop(DropDatabase query) throws LSHException {
		ResponseDropDatabase response = query.getResponse();
		if (query.databaseName == null) {
			throw new LSHException("Missing databaseName for drop database");
		}
		if (!query.databaseName.equals(ds.getServerInfo().getDBName())) {
			throw new UnsupportedOperationException("drop database name must match");
		}
		response.dropSuccessful = true;		// Response parameters assuming success
		response.errorMessage = null;
		try {
			dropDatabase();
		}
		catch (SQLException e) {
			String msg = e.getMessage();
			if (msg.indexOf("database \"" + query.databaseName + "\" does not exist") > 0) {
				return; // missing database
			}
			response.dropSuccessful = false;
			response.errorMessage = e.getMessage();
		}
	}

	/**
	 * Entry point for the CreateDatabase command

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Set query.databaseName to exactly match ds.getServerInfo().getDBName() for the active connection before executing the DropDatabase query.
  2. Establish a fresh connection to the server whose DBName equals the database you intend to drop, then issue the drop.
  3. Verify the name match programmatically via getServerInfo().getDBName() before building the query.

Example fix

// before
dropQuery.databaseName = "mydb"; // connected to 'postgres'
db.execute(dropQuery);
// after
dropQuery.databaseName = db.getServerInfo().getDBName();
db.execute(dropQuery);
Defensive patterns

Strategy: validation

Validate before calling

String dbName = db.getServerInfo().getDBName();
if (!dbName.equals(dropQuery.databaseName)) {
    dropQuery.databaseName = dbName; // or abort
}

Try / catch

catch (UnsupportedOperationException e) { /* re-establish connection to correct DB or correct databaseName, then retry */ }

Prevention

When it happens

Trigger: Issuing a DropDatabase query where query.databaseName is non-null but differs from the live connection's configured database name. Also triggered when databaseName is set but the connection string's DBName differs (e.g., connected to 'postgres' maintenance DB but requesting drop of 'mydb').

Common situations: Connecting to a PostgreSQL server using a maintenance/generic database name but trying to drop a differently-named BSim database; mismatch between the BSim URL's database path and the name supplied in the drop request; scripting a batch drop across multiple DBs through one connection.

Related errors


AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14). Data as JSON: /api/errors/c4e6d50584b37e29. Report an issue: GitHub.