NationalSecurityAgency/ghidra · error · NoDatabaseException
Database instance does not exist
Error message
Database instance does not exist
What it means
Thrown as a NoDatabaseException in readKeyValues when the configuration/_search GET request fails and the ElasticException message contains "index_not_found_exception". This means the repository's configuration index does not exist on the Elasticsearch server — the database has never been created via the generate/create command.
Source
Thrown at Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/elastic/ElasticDatabase.java:2104
}
/**
* Read database configuration ("keyvalue" documents) into a key/value pair map.
* @return the populated map
* @throws ElasticException for communication problems with the server
* @throws NoDatabaseException if the database (as opposed to the server) does not exist
*/
private Map<String, String> readKeyValues() throws ElasticException, NoDatabaseException {
StringBuilder buffer = new StringBuilder();
buffer.append("{ \"size\": 500, \"query\": { \"match_all\": {} } }");
JsonObject resp;
try {
resp = connection.executeStatement(ElasticConnection.GET, "configuration/_search",
buffer.toString());
}
catch (ElasticException ex) {
if (ex.getMessage().contains("index_not_found_exception")) {
throw new NoDatabaseException("Database instance does not exist");
}
throw ex;
}
JsonObject baseHits = (JsonObject) resp.get("hits");
long total = 0;
if (baseHits != null) {
JsonObject totalRec = (JsonObject) baseHits.get("total");
total = totalRec.get("value").getAsLong();
}
if (total <= 1) {
throw new ElasticException("Unrecoverable error: Could not find configuration");
}
HashMap<String, String> res = new HashMap<>();
JsonArray hits = (JsonArray) baseHits.get("hits");
for (JsonElement hit2 : hits) {
JsonObject hit = (JsonObject) hit2;
String key = hit.get("_id").getAsString();
JsonObject source = (JsonObject) hit.get("_source");View on GitHub (pinned to d5f144c24d)
Solutions
- Create the database first using the BSim generate/create command with the same URL and repository name.
- Verify the repository name in the connection URL matches an existing repository on the server.
- Confirm you are connecting to the correct Elasticsearch server and port.
- Check the initialize() return value and lastError to distinguish NoDatabase from other initialization failures.
Defensive patterns
Strategy: validation
Validate before calling
// Check if the database exists before initializing
try {
connection.executeURIOnly(ElasticConnection.GET, "configuration/_search");
} catch (ElasticException e) {
if (e.getMessage().contains("index_not_found_exception")) {
// Database does not exist — prompt user to create it
Msg.warn(this, "Database does not exist. Run 'bsim generate' first.");
return;
}
} Try / catch
if (!database.initialize()) {
BSimError err = database.getLastError();
if (err != null && err.category == ErrorCategory.Nodatabase) {
Msg.warn(this, "Database not created yet: " + err.message);
// Prompt user to run generate/create
}
} Prevention
- Run the generate/create command before connecting to a new repository.
- Check the initialize() return value and lastError category to distinguish missing-database from other failures.
- Verify the repository name in the URL matches an existing repository on the server.
When it happens
Trigger: During initialize(), readKeyValues queries configuration/_search. If the Elasticsearch server responds with an index_not_found_exception for the configuration index, the catch block converts it to NoDatabaseException. This is caught by initialize() which sets status to Error and lastError to a Nodatabase category.
Common situations: First-time connection to a new Elasticsearch server before running generate; typo in the repository name in the URL; the database was dropped; connecting to the wrong server or port.
Related errors
- Unrecoverable error: Could not find configuration
- Missing critical configuration value:
- weighttable has wrong number of rows
- Unknown response trying to adjust number_of_replicas and ref
- Cluster did not accept settings for index:
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/4f1b71880b03693d.
Report an issue: GitHub.