apache/druid · error · RE
%s: Malformed url for DruidNode [%s] and baseUrl [%s]
Error message
%s: Malformed url for DruidNode [%s] and baseUrl [%s]
What it means
getListenerURL builds the catalog sync listener URL from a DruidNode's host/port and a baseUrl. If java.net.URL considers the constructed string malformed (bad host characters, missing scheme after concat, illegal port), it logs and rethrows as a ResourceException (RE) wrapping the MalformedURLException.
Source
Thrown at extensions-core/druid-catalog/src/main/java/org/apache/druid/catalog/sync/RestUpdateSender.java:190
cacheNotificationsTimeoutMs,
TimeUnit.MILLISECONDS
);
}
private URL getListenerURL(DruidNode druidNode, String baseUrl)
{
try {
return new URL(
druidNode.getServiceScheme(),
druidNode.getHost(),
druidNode.getPortToUse(),
baseUrl
);
}
catch (MalformedURLException mue) {
String msg = StringUtils.format(callerName + ": Malformed url for DruidNode [%s] and baseUrl [%s]", druidNode, baseUrl);
LOG.error(msg);
throw new RE(mue, msg);
}
}
}
View on GitHub (pinned to 9b90983fd2)
Solutions
- Fix druid.host to a valid URL hostname (RFC 1123: no underscores, use hyphens) and restart.
- Ensure baseUrl includes the scheme, e.g. 'http://' or 'https://'.
- If using IPv6, set druid.host to the bracketed form or a resolvable hostname.
- Log/inspect the generated URL string (druidNode + baseUrl) to spot the malformed part, then correct the config value.
Example fix
// before druid.host=my_pod_name // underscore -> Malformed URL // after druid.host=my-pod-name.my-namespace.svc.cluster.local
Defensive patterns
Strategy: validation
Validate before calling
String host = druidNode.getHost();
if (host.contains("_") || !baseUrl.matches("^https?://.*")) {
throw new IllegalArgumentException("Invalid druid.host or baseUrl missing scheme: " + host + ", " + baseUrl);
} Try / catch
try {
URL url = getListenerURL(druidNode, callerName, baseUrl);
} catch (RE e) {
LOG.error("Bad catalog listener URL config: host=%s baseUrl=%s", druidNode.getHost(), baseUrl);
} Prevention
- Use RFC 1123 hostnames (hyphens, no underscores) for druid.host.
- Always include http:// or https:// in baseUrl config.
- Validate templated host values in CI before deploy.
- Bracket IPv6 addresses or prefer resolvable hostnames.
When it happens
Trigger: accept() → getListenerURL() with a druidNode whose host contains invalid URL characters (e.g. underscores, IPv6 literal without brackets) or a baseUrl missing the http(s):// scheme, so the concatenation 'scheme://host:port/baseUrl' fails URL parsing.
Common situations: Kubernetes pod names with underscores used as druid.host; baseUrl configured without protocol; misconfigured druid.host containing scheme already (double scheme); special characters from templated config values.
Understand the failure class
Background: "Invalid URL" errors: why new URL(), URI.parse, and reqwest::Url reject your string — missing scheme, whitespace, and bad path format — this error's family across 39 libraries.
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- Bad URL: %s
- Failed to construct server URL.
- Failed to start lookup [%s]:[%s]
- The gRPC query server requires either a Basic or Anonymous a
- Metric [%s] not whitelisted.
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/2b710c318a46898d.
Report an issue: GitHub.