{"record":{"id":"91e29ec438c4e5b8","repo":"NationalSecurityAgency/ghidra","slug":"invalid-databasename-name","errorCode":null,"errorMessage":"Invalid databaseName name","messagePattern":"Invalid databaseName name","errorType":"validation","errorClass":"LSHException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/elastic/ElasticDatabase.java","lineNumber":3399,"sourceCode":"\t\tResponseUpdate response = query.updateresponse;\n\t\tfor (ExecutableRecord erec : query.manage.getExecutableRecordSet()) {\n\t\t\tint res = updateExecutable(query.manage, erec, response.badfunc);\n\t\t\tif (res < 0) {\n\t\t\t\tresponse.badexe.add(erec);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif ((res & 1) != 0) {\n\t\t\t\t\tresponse.exeupdate += 1;\n\t\t\t\t}\n\t\t\t\tresponse.funcupdate += res >> 1;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate void fdbDatabaseDrop(DropDatabase query) throws LSHException {\n\t\tResponseDropDatabase response = query.getResponse();\n\t\tif (!serverInfo.getDBName().equals(query.databaseName)) {\n\t\t\tthrow new LSHException(\"Invalid databaseName name\");\n\t\t}\n\t\tresponse.dropSuccessful = true;\t\t// Response parameters assuming success\n\t\tresponse.errorMessage = null;\n\t\ttry {\n\t\t\tdropDatabase();\n\t\t}\n\t\tcatch (ElasticException e) {\n\t\t\tresponse.dropSuccessful = false;\n\t\t\tresponse.errorMessage = e.getMessage();\n\t\t}\n\t}\n\n\t/**\n\t * Entry point for the Elasticsearch version of PasswordChange command.\n\t * @param query is command parameters\n\t * @throws LSHException if details of the request are malformed\n\t */\n\tprivate void fdbPasswordChange(PasswordChange query) throws LSHException {","sourceCodeStart":3381,"sourceCodeEnd":3417,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/elastic/ElasticDatabase.java#L3381-L3417","documentation":"fdbDatabaseDrop compares serverInfo.getDBName() to query.databaseName; a mismatch throws LSHException(\"Invalid databaseName name\"). It is a safety check: you may only drop the database you are currently connected to.","triggerScenarios":"Issuing DropDatabase with a databaseName that differs from the connected database's name.","commonSituations":"Copy-paste of the wrong name; connecting to database A and attempting to drop database B; stale config referencing a renamed database.","solutions":["Supply the exact name of the database you are connected to.","Connect to the target database before issuing DropDatabase."],"exampleFix":"// before\nreq.databaseName = \"oldName\"; // != connected db\n// after\nreq.databaseName = db.getServerInfo().getDBName();","handlingStrategy":"validation","validationCode":"if (!db.getServerInfo().getDBName().equals(req.databaseName))\n    throw new IllegalArgumentException(\"databaseName must match the connected database\");","typeGuard":"boolean nameMatches = db.getServerInfo().getDBName().equals(req.databaseName);","tryCatchPattern":null,"preventionTips":["Always source the drop name from the live connection's serverInfo.","Require explicit confirmation before drop commands."],"tags":["bsim","database-admin","validation","safety"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}