NationalSecurityAgency/ghidra · critical · LSHException
Unable to connect to server
Error message
Unable to connect to server
What it means
Thrown by ExecutableComparison.pullConnectionInfo when database.initialize() returns false, meaning the BSim FunctionDatabase could not establish or validate a connection to the backing SQL/Elasticsearch server. This is the first connectivity gate before any query is issued.
Source
Thrown at Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/client/ExecutableComparison.java:141
return exceedCount;
}
/**
* @return true if similarity and significance thresholds have been set
*/
public boolean isConfigured() {
return (scorer.simThreshold > 0.0);
}
/**
* Make sure the database has an active connection. Query for basic
* information and inform the scorer of settings
* @return information from the database
* @throws LSHException if something is wrong with the connection
*/
private DatabaseInformation pullConnectionInfo() throws LSHException {
if (!database.initialize()) {
throw new LSHException("Unable to connect to server");
}
QueryInfo query = new QueryInfo();
ResponseInfo response = query.execute(database);
if (response == null) {
throw new LSHException(database.getLastError().message);
}
vectorFactory = database.getLSHVectorFactory();
return response.info;
}
/**
* Look up a full ExecutableRecord in the database given an md5
* @param md5 is the md5 String
* @return the corresponding ExecutableRecord
* @throws LSHException if there are problems accessing the database
* or the executable doesn't exist
*/
private ExecutableRecord lookupExecutable(String md5) throws LSHException {View on GitHub (pinned to d5f144c24d)
Solutions
- Verify the BSim server URL, host, port, and database name are correct and the server is running.
- Check network connectivity (telnet/ping to the host:port) and credentials.
- Ensure the database has been created (BSim DBs must be created before connection).
- Inspect db.getLastError() after initialize() returns false for the specific cause.
Example fix
// before
ExecutableComparison cmp = new ExecutableComparison(db);
cmp.addAllExecutables(0); // throws if not initialized
// after
if (!db.initialize()) {
BSimError err = db.getLastError();
throw new RuntimeException("BSim connection failed: " + (err != null ? err.message : "unknown"), err);
} Defensive patterns
Strategy: validation
Validate before calling
if (!database.initialize()) {
BSimError err = database.getLastError();
// surface err.message to the user; do not proceed with ExecutableComparison
return;
} Try / catch
catch (LSHException e) { if (e.getMessage().contains("Unable to connect")) { /* check server, credentials, URL; retry after fix */ } } Prevention
- Always call database.initialize() and check its boolean return before using ExecutableComparison.
- Validate the BSim URL format and server reachability at application startup.
- Inspect getLastError() for the root cause rather than retrying blindly.
When it happens
Trigger: Calling ExecutableComparison scoring/comparison methods when the database server is unreachable, credentials are wrong, the target database doesn't exist, or the connection URL is malformed. initialize() returns false on any connection failure.
Common situations: Wrong BSim URL (host/port/dbname); PostgreSQL or Elasticsearch server down; firewall blocking the port; expired credentials; SSL/TLS mismatch; database not yet created.
Related errors
- {database.getLastError().message}
- connection.getResponseMessage()
- Error sending request: {message}
- {}
- Unknown error connection to: {}
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/6c6386fb12b0e1aa.
Report an issue: GitHub.