apache/druid · error · IllegalArgumentException
Conflicting host:port [%s] and port [%d] settings
Error message
Conflicting host:port [%s] and port [%d] settings
What it means
DruidNode allows the host property to embed a port (host:port form). If the embedded port in druid.host conflicts with the separately configured plaintext port, init() throws IAE because the two settings disagree.
Source
Thrown at server/src/main/java/org/apache/druid/server/DruidNode.java:185
{
Preconditions.checkNotNull(serviceName);
if (!enableTlsPort && !enablePlaintextPort) {
throw new IAE("At least one of the druid.enablePlaintextPort or druid.enableTlsPort needs to be true.");
}
this.enablePlaintextPort = enablePlaintextPort;
this.enableTlsPort = enableTlsPort;
final boolean nullHost = host == null;
HostAndPort hostAndPort;
Integer portFromHostConfig;
if (host != null) {
hostAndPort = HostAndPort.fromString(host);
host = hostAndPort.getHost();
portFromHostConfig = hostAndPort.hasPort() ? hostAndPort.getPort() : null;
if (plainTextPort != null && portFromHostConfig != null && !plainTextPort.equals(portFromHostConfig)) {
throw new IAE("Conflicting host:port [%s] and port [%d] settings", host, plainTextPort);
}
if (portFromHostConfig != null) {
plainTextPort = portFromHostConfig;
}
} else {
host = getDefaultHost();
}
if (enablePlaintextPort && enableTlsPort && ((plainTextPort == null || tlsPort == null)
|| plainTextPort.equals(tlsPort))) {
// If both plainTExt and tls are enabled then do not allow plaintextPort to be null or
throw new IAE("plaintextPort and tlsPort cannot be null or same if both http and https connectors are enabled");
}
if (enableTlsPort && (tlsPort == null || tlsPort < 0)) {
throw new IAE("A valid tlsPort needs to specified when druid.enableTlsPort is set");
}
if (enablePlaintextPort) {View on GitHub (pinned to 9b90983fd2)
Solutions
- Make druid.host contain no port and rely on druid.port alone
- Make the port embedded in druid.host exactly match druid.port
- Fix the templating variables so host and port derive from one source
Example fix
// before druid.host=node1.example.com:8080 druid.port=8081 // after druid.host=node1.example.com druid.port=8081
Defensive patterns
Strategy: validation
Validate before calling
HostAndPort hap = HostAndPort.fromString(druidHost);
if (hap.hasPort() && hap.getPort() != druidPort) {
throw new IllegalArgumentException("druid.host port " + hap.getPort()
+ " conflicts with druid.port " + druidPort);
} Try / catch
try {
node = new DruidNode(service, druidHost, true, druidPort, tlsPort, false, false);
} catch (IllegalArgumentException e) {
log.fatal("Conflicting host:port settings: %s", e.getMessage());
throw e;
} Prevention
- Prefer portless druid.host plus druid.port
- If embedding a port in druid.host, remove druid.port from that node's config
- Template host and port from a single variable
- Lint configs for host values containing ':' combined with druid.port
When it happens
Trigger: Setting druid.host=myhost:8080 while druid.port (plaintextPort) is set to a different value, e.g. 8081; host strings with stale ports left after config refactors.
Common situations: Config templating that appends a fixed port to druid.host while druid.port comes from another variable; copy-paste of host entries from other clusters.
Related errors
- At least one of the druid.enablePlaintextPort or druid.enabl
- plaintextPort and tlsPort cannot be null or same if both htt
- A valid tlsPort needs to specified when druid.enableTlsPort
- 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/f97a929597617b6a.
Report an issue: GitHub.