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

  1. Always call checkBSimServerURL(url) (or deriveBSimURL) before buildClient to validate the protocol.
  2. Ensure the URL protocol is one of: postgresql, https, elastic, file.
  3. If you extended checkBSimServerURL to accept a new protocol, also add the corresponding database construction branch in buildClient.
  4. 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

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


AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14). Data as JSON: /api/errors/ea0a9335aa7b73d2. Report an issue: GitHub.