NationalSecurityAgency/ghidra · error · IllegalArgumentException
Non-empty dbName required
Error message
Non-empty dbName required
What it means
Thrown by the BSimServerInfo(DBType, ...) multi-argument constructor when, after trimming, the dbName argument is empty. Every database type requires a non-empty database name. Throws IllegalArgumentException.
Source
Thrown at Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/BSimServerInfo.java:89
* If blank, {@link ClientUtil#getUserName()} is used.
* @param host host name (ignored for {@link DBType#file})
* @param port port number (ignored for {@link DBType#file}, -1 for default)
* @param dbName name of database (simple database name except for {@link DBType#file}
* which should reflect an absolute file path. On Windows OS the path may start with a
* drive letter.
* @throws IllegalArgumentException if invalid arguments are specified
*/
public BSimServerInfo(DBType dbType, String userinfo, String host, int port, String dbName) {
Objects.requireNonNull(dbType, "DBType must be specified");
this.dbType = dbType;
if ((dbType == DBType.postgres || dbType == DBType.elastic) && StringUtils.isEmpty(host)) {
throw new IllegalArgumentException("host required");
}
dbName = dbName.trim();
if (StringUtils.isEmpty(dbName)) {
throw new IllegalArgumentException("Non-empty dbName required");
}
if (dbType == DBType.file) {
host = null;
port = -1;
userinfo = null;
dbName = cleanupFilename(dbName);
}
else {
if (dbName.contains("/") || dbName.contains("\\")) { // may want additional validation
throw new IllegalArgumentException("Invalid " + dbType + " dbName: " + dbName);
}
userinfo = cleanupUserInfo(userinfo);
if (port <= 0) {
port = -1;
}
if (dbType == DBType.postgres && port <= 0) {
port = DEFAULT_POSTGRES_PORT;View on GitHub (pinned to d5f144c24d)
Solutions
- Ensure the dbName argument is a non-empty, trimmed value before constructing.
- Validate dbName with StringUtils.isBlank() and fail early with a clearer message.
- Check the upstream configuration that populates the dbName.
Example fix
// before
new BSimServerInfo(DBType.postgres, null, "host", 5432, dbNameField); // dbNameField is " "
// after
if (StringUtils.isBlank(dbNameField)) throw new IllegalArgumentException("dbName not configured");
new BSimServerInfo(DBType.postgres, null, "host", 5432, dbNameField); Defensive patterns
Strategy: validation
Validate before calling
if (StringUtils.isBlank(dbName)) {
throw new IllegalArgumentException("dbName must be non-empty");
} Prevention
- Check dbName with StringUtils.isBlank() before constructing.
- Fail early in configuration loading when the database name is unset.
- Wrap BSimServerInfo construction in a factory that validates all fields.
When it happens
Trigger: Calling the multi-arg constructor with a null, blank, or whitespace-only dbName argument (e.g. 'new BSimServerInfo(DBType.postgres, null, "host", 5432, " ")').
Common situations: dbName sourced from an unset or whitespace-only configuration field; parsing a URL/connection string that omitted the database name.
Related errors
- host required
- Invalid {} dbName: {}
- Remote file URL not supported: {}
- Unsupported BSim URL protocol: {}
- Missing dbName in URL: {}
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/e1e6a7de850d40b9.
Report an issue: GitHub.