{"record":{"id":"adb2183908ccd0e0","repo":"NationalSecurityAgency/ghidra","slug":"database-does-not-exist","errorCode":null,"errorMessage":"Database does not exist","messagePattern":"Database does not exist","errorType":"exception","errorClass":"QueryDatabaseException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/gui/search/dialog/BSimServerCache.java","lineNumber":61,"sourceCode":"\t\treturn databaseInfo;\n\t}\n\n\t/**\n\t * Get cached {@link LSHVectorFactory} for the active BSim Function Database \n\t * @return vector factory or null if DB server not set or never connected\n\t */\n\tpublic LSHVectorFactory getLSHVectorFactory() {\n\t\treturn lshVectorFactory;\n\t}\n\n\tprivate void initialize() throws QueryDatabaseException {\n\t\ttry (FunctionDatabase database = serverInfo.getFunctionDatabase(false)) {\n\t\t\tif (!database.initialize()) { // error message will be set on failure\n\t\t\t\tString errorMessage = database.getLastError().message;\n\t\t\t\tif (database.getLastError().category == ErrorCategory.Nodatabase) {\n\t\t\t\t\terrorMessage = \"Database does not exist\";\n\t\t\t\t}\n\t\t\t\tthrow new QueryDatabaseException(errorMessage);\n\t\t\t}\n\t\t\tdatabaseInfo = database.getInfo();\n\t\t\tlshVectorFactory = database.getLSHVectorFactory();\n\t\t}\n\t}\n\n}\n","sourceCodeStart":43,"sourceCodeEnd":69,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/gui/search/dialog/BSimServerCache.java#L43-L69","documentation":"BSimServerCache.initialize() calls database.initialize() and if it returns false, checks the error category. If the category is ErrorCategory.Nodatabase, the error message is overridden to 'Database does not exist' before throwing QueryDatabaseException. This means the server was reachable but the named database/repository does not exist on it.","triggerScenarios":"Calling initialize() (triggered lazily when the cache is first accessed) where serverInfo.getFunctionDatabase(false).initialize() returns false and getLastError().category == ErrorCategory.Nodatabase. The server connection succeeded but the database name in the URL doesn't resolve to an actual database.","commonSituations":"The BSim URL points to a server that is up but the database name/path in the URL doesn't exist (typo, wrong repo name); the database was never created on the server; the database was dropped; connecting to the wrong server instance; case mismatch in the database name.","solutions":["Verify the database name in the BSim URL matches an existing database on the server (list databases via BSim command-line tools).","Create the database on the server if it doesn't exist (bsimctl or the appropriate BSim administration command).","Check for typos or case sensitivity in the URL path component.","Confirm you're connecting to the correct server host/port."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Before initializing, check that the database exists on the server\ntry (FunctionDatabase db = serverInfo.getFunctionDatabase(false)) {\n    if (!db.initialize()) {\n        if (db.getLastError().category == ErrorCategory.Nodatabase) {\n            // prompt: create the database first, or fix the URL\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    bsimServerCache.getSomething();\n} catch (QueryDatabaseException e) {\n    if (\"Database does not exist\".equals(e.getMessage())) {\n        // guide user to create the database or correct the URL\n    } else {\n        throw e;\n    }\n}","preventionTips":["Validate the database name exists on the BSim server before adding it to the cache.","Provide a 'test connection' step in the BSim connection UI that reports Nodatabase clearly.","Create databases via bsimctl before referencing them in the client.","Check for case-sensitivity in database names when configuring URLs."],"tags":["bsim","database","server-connection","querydatabaseexception"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}