{"record":{"id":"f97a929597617b6a","repo":"apache/druid","slug":"conflicting-host-port-s-and-port-d-settings","errorCode":null,"errorMessage":"Conflicting host:port [%s] and port [%d] settings","messagePattern":"Conflicting host:port \\[(.+?)\\] and port \\[(.+?)\\] settings","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"server/src/main/java/org/apache/druid/server/DruidNode.java","lineNumber":185,"sourceCode":"  {\n    Preconditions.checkNotNull(serviceName);\n\n    if (!enableTlsPort && !enablePlaintextPort) {\n      throw new IAE(\"At least one of the druid.enablePlaintextPort or druid.enableTlsPort needs to be true.\");\n    }\n\n    this.enablePlaintextPort = enablePlaintextPort;\n    this.enableTlsPort = enableTlsPort;\n\n    final boolean nullHost = host == null;\n    HostAndPort hostAndPort;\n    Integer portFromHostConfig;\n    if (host != null) {\n      hostAndPort = HostAndPort.fromString(host);\n      host = hostAndPort.getHost();\n      portFromHostConfig = hostAndPort.hasPort() ? hostAndPort.getPort() : null;\n      if (plainTextPort != null && portFromHostConfig != null && !plainTextPort.equals(portFromHostConfig)) {\n        throw new IAE(\"Conflicting host:port [%s] and port [%d] settings\", host, plainTextPort);\n      }\n      if (portFromHostConfig != null) {\n        plainTextPort = portFromHostConfig;\n      }\n    } else {\n      host = getDefaultHost();\n    }\n\n    if (enablePlaintextPort && enableTlsPort && ((plainTextPort == null || tlsPort == null)\n                                                 || plainTextPort.equals(tlsPort))) {\n      // If both plainTExt and tls are enabled then do not allow plaintextPort to be null or\n      throw new IAE(\"plaintextPort and tlsPort cannot be null or same if both http and https connectors are enabled\");\n    }\n    if (enableTlsPort && (tlsPort == null || tlsPort < 0)) {\n      throw new IAE(\"A valid tlsPort needs to specified when druid.enableTlsPort is set\");\n    }\n\n    if (enablePlaintextPort) {","sourceCodeStart":167,"sourceCodeEnd":203,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/server/src/main/java/org/apache/druid/server/DruidNode.java#L167-L203","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\n  druid.host=node1.example.com:8080\n  druid.port=8081\n// after\n  druid.host=node1.example.com\n  druid.port=8081","handlingStrategy":"validation","validationCode":"HostAndPort hap = HostAndPort.fromString(druidHost);\nif (hap.hasPort() && hap.getPort() != druidPort) {\n  throw new IllegalArgumentException(\"druid.host port \" + hap.getPort()\n      + \" conflicts with druid.port \" + druidPort);\n}","typeGuard":null,"tryCatchPattern":"try {\n  node = new DruidNode(service, druidHost, true, druidPort, tlsPort, false, false);\n} catch (IllegalArgumentException e) {\n  log.fatal(\"Conflicting host:port settings: %s\", e.getMessage());\n  throw e;\n}","preventionTips":["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"],"tags":["configuration","druid-node","ports","conflict"],"backgroundTag":"conflicting-config-options","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}