NationalSecurityAgency/ghidra · error · MalformedURLException
Unsupported protocol: {}
Error message
Unsupported protocol: {} What it means
BSimClientFactory.buildClient() dispatches on the URL protocol to construct the correct FunctionDatabase implementation (PostgresFunctionDatabase for postgresql, ElasticDatabase for https/elastic, H2FileFunctionDatabase for file). If none match, MalformedURLException is thrown. Note: checkBSimServerURL accepts the same four protocols, so reaching this throw typically means buildClient was called without prior URL validation, or the URL was modified after validation.
Source
Thrown at Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/BSimClientFactory.java:162
* @param bsimURL URL supplied by the user
* @param async true if database commits should be synchronous
* @return the database client
* @throws MalformedURLException if there's a problem creating the elastic database
*/
public static FunctionDatabase buildClient(URL bsimURL, boolean async)
throws MalformedURLException {
String protocol = bsimURL.getProtocol();
if (protocol.equals("postgresql")) {
return new PostgresFunctionDatabase(bsimURL, async);
}
if (protocol.equals("https") || protocol.equals("elastic")) {
return new ElasticDatabase(bsimURL);
}
if ("file".equals(protocol)) {
return new H2FileFunctionDatabase(bsimURL);
}
throw new MalformedURLException("Unsupported protocol: " + protocol);
}
}
View on GitHub (pinned to d5f144c24d)
Solutions
- Always call checkBSimServerURL(url) (or deriveBSimURL) before buildClient to validate the protocol.
- Ensure the URL protocol is one of: postgresql, https, elastic, file.
- If you extended checkBSimServerURL to accept a new protocol, also add the corresponding database construction branch in buildClient.
- Audit code paths that call buildClient directly to ensure they validate first.
Example fix
// before FunctionDatabase db = BSimClientFactory.buildClient(url, true); // unvalidated // // after — validate first BSimClientFactory.checkBSimServerURL(url); FunctionDatabase db = BSimClientFactory.buildClient(url, true);
Defensive patterns
Strategy: validation
Validate before calling
// Always validate before building the client BSimClientFactory.checkBSimServerURL(bsimURL); // Now safe to build — protocols validated FunctionDatabase db = BSimClientFactory.buildClient(bsimURL, async);
Try / catch
try {
FunctionDatabase db = BSimClientFactory.buildClient(url, true);
} catch (MalformedURLException e) {
if (e.getMessage().startsWith("Unsupported protocol")) {
// URL was not validated — call checkBSimServerURL first
} else {
throw e;
}
} Prevention
- Always call checkBSimServerURL(url) or deriveBSimURL(urlString) before buildClient.
- If extending checkBSimServerURL to accept a new protocol, add the matching branch in buildClient.
- Treat buildClient as a private/dispatch method — callers should go through the validated entry points.
- Add a unit test that verifies every protocol accepted by checkBSimServerURL is handled by buildClient.
When it happens
Trigger: Calling BSimClientFactory.buildClient(bsimURL, async) where bsimURL.getProtocol() is not postgresql, https, elastic, or file. This should not happen if checkBSimServerURL was called first, but can occur if buildClient is called directly with an unvalidated URL.
Common situations: Direct call to buildClient bypassing checkBSimServerURL; URL protocol changed between validation and client construction (race/bug); a new protocol was added to checkBSimServerURL but no corresponding database implementation exists in buildClient; code path that constructs the URL dynamically without validation.
Related errors
- Protocol not permissable for BSim URL
- BSim URL missing DB name/path
- BSim URL must specify exactly 1 path element
- URL is not ghidra protocol: {}
- Invalid repository URL: {}
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/ea0a9335aa7b73d2.
Report an issue: GitHub.