{"record":{"id":"1340332d1cc5bea6","repo":"NationalSecurityAgency/ghidra","slug":"nodatabaseexception-baseurl","errorCode":null,"errorMessage":"NoDatabaseException: baseURL","messagePattern":"NoDatabaseException: baseURL","errorType":"exception","errorClass":"NoDatabaseException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/elastic/ElasticDatabase.java","lineNumber":2394,"sourceCode":"\tprivate void initializeElastic(Configuration config)\n\t\t\tthrows ElasticException, NoDatabaseException {\n\t\tconnection = new ElasticConnection(baseURL, repository);\n\t\tif (baseURL.startsWith(\"https\")) {\n\t\t\tconnectionType = ConnectionType.SSL_Password_Authentication;\n\t\t}\n\t\tconfig.info = new DatabaseInformation();\n\t\treadBasicInfo(config);\n\n\t\tvectorFactory = new Base64VectorFactory();\n\t\tconfig.weightfactory = new WeightFactory();\n\t\tconfig.idflookup = new IDFLookup();\n\t\tJsonObject res;\n\t\ttry {\n\t\t\tres = connection.executeURIOnly(ElasticConnection.GET, \"vector/_settings\");\n\t\t}\n\t\tcatch (ElasticException ex) {\n\t\t\tif (ex.getMessage().contains(\"no such index\")) {\n\t\t\t\tthrow new NoDatabaseException(baseURL);\n\t\t\t}\n\t\t\tthrow ex;\n\t\t}\n\t\tJsonObject repo = (JsonObject) res.get(repository + \"_vector\");\n\t\tJsonObject settings = (JsonObject) repo.get(\"settings\");\n\t\tJsonObject index = (JsonObject) settings.get(\"index\");\n\t\tJsonObject analysis = (JsonObject) index.get(\"analysis\");\n\t\tJsonObject tokenizer = (JsonObject) analysis.get(\"tokenizer\");\n\t\tString tokenizerName = null;\n\t\tfor (String key : tokenizer.keySet()) {\n\t\t\tif (key.startsWith(\"lsh_\")) {\n\t\t\t\ttokenizerName = key;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (tokenizerName == null) {\n\t\t\tthrow new ElasticException(\"Missing tokenizer configuration\");\n\t\t}","sourceCodeStart":2376,"sourceCodeEnd":2412,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/elastic/ElasticDatabase.java#L2376-L2412","documentation":"During database initialization the code GETs 'vector/_settings'. If Elasticsearch responds with an error whose message contains 'no such index', the core 'vector' index of the BSim database does not exist on that URL, so NoDatabaseException(baseURL) is thrown: the named database was never created at that server.","triggerScenarios":"Opening/connecting to a BSim Elasticsearch URL whose repository+database was never created (the create-database step was not run, or was run against a different cluster).","commonSituations":"Wrong bsim:// URL or typo in the database name; server reset/rebuilt; connecting to the wrong ES cluster; create-database step skipped or failed silently.","solutions":["Run the BSim create-database workflow for that URL/name first.","Verify the URL/database name spelling and that it resolves to the intended ES host.","Point the client at the cluster that actually hosts the index."],"exampleFix":"// before\nFunctionDatabase db = FunctionDatabase.getInstance();\ndb.initialize(url); // throws NoDatabaseException\n// after\nif (!databaseExistsOnCluster(url)) {\n    createDatabase(url, template); // first-time setup\n}\nFunctionDatabase db = FunctionDatabase.getInstance();\ndb.initialize(url);","handlingStrategy":"validation","validationCode":"// Check the index exists before opening.\nboolean exists = esClient.indices().exists(b -> b.index(repo + \"_vector\")).value();\nif (!exists) throw new NoDatabaseException(url);","typeGuard":"boolean databaseInitialized = esClient.indices().exists(e -> e.index(repo + \"_vector\")).value();","tryCatchPattern":"try {\n    db.initialize(url);\n} catch (NoDatabaseException e) {\n    // first run: create then retry\n    createDatabase(url, template); db.initialize(url);\n}","preventionTips":["Run create-database as a documented prerequisite in deploy runbooks.","Resolve database names centrally to avoid typos."],"tags":["bsim","elasticsearch","setup","database-missing"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}