{"record":{"id":"37bcbc4eb21e0c71","repo":"apache/druid","slug":"unable-to-determine-host-name","errorCode":null,"errorMessage":"Unable to determine host name","messagePattern":"Unable to determine host name","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"critical","filePath":"server/src/main/java/org/apache/druid/server/DruidNode.java","lineNumber":342,"sourceCode":"  }\n\n  public URI getUriToUse()\n  {\n    try {\n      return new URI(getServiceScheme(), null, host, getPortToUse(), null, null, null);\n    }\n    catch (URISyntaxException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  public static String getDefaultHost()\n  {\n    try {\n      return InetAddress.getLocalHost().getCanonicalHostName();\n    }\n    catch (UnknownHostException e) {\n      throw new ISE(e, \"Unable to determine host name\");\n    }\n  }\n\n  @Override\n  public boolean equals(Object o)\n  {\n    if (this == o) {\n      return true;\n    }\n    if (o == null || getClass() != o.getClass()) {\n      return false;\n    }\n    DruidNode druidNode = (DruidNode) o;\n    return port == druidNode.port &&\n           bindOnHost == druidNode.bindOnHost &&\n           plaintextPort == druidNode.plaintextPort &&\n           enablePlaintextPort == druidNode.enablePlaintextPort &&\n           tlsPort == druidNode.tlsPort &&","sourceCodeStart":324,"sourceCodeEnd":360,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/server/src/main/java/org/apache/druid/server/DruidNode.java#L324-L360","documentation":"DruidNode.getDefaultHost() resolves the machine's canonical hostname via InetAddress.getLocalHost(). If the JVM cannot resolve the local host (misconfigured /etc/hosts, missing hostname entry, DNS issues), it wraps the UnknownHostException in an ISE with this message, aborting node startup.","triggerScenarios":"Starting any Druid node on a machine where InetAddress.getLocalHost() throws UnknownHostException — e.g. hostname not in /etc/hosts, container without proper hostname resolution, broken DNS.","commonSituations":"Kubernetes pods or Docker containers with unresolvable hostnames; /etc/hosts missing the 127.0.0.1 hostname mapping; cloud images without hostname set.","solutions":["Set druid.host explicitly in runtime.properties so getDefaultHost() is never called","Add the machine's hostname to /etc/hosts (e.g. 127.0.1.1 myhost) so resolution succeeds","Fix DNS/hostname configuration in the container or host image"],"exampleFix":"// before\nruntime.properties: (no druid.host)\n// after\n  druid.host=druid-broker-0.druid-broker-headless.default.svc.cluster.local","handlingStrategy":"validation","validationCode":"try {\n  String canonical = InetAddress.getLocalHost().getCanonicalHostName();\n} catch (UnknownHostException e) {\n  throw new IllegalStateException(\"Fix /etc/hosts or set druid.host explicitly\", e);\n}","typeGuard":null,"tryCatchPattern":"try {\n  node = new DruidNode(service, null, true, port, null, false, false);\n} catch (ISE e) {\n  if (e.getMessage() != null && e.getMessage().contains(\"Unable to determine host name\")) {\n    log.fatal(\"Hostname unresolvable; set druid.host or fix /etc/hosts\");\n  }\n  throw e;\n}","preventionTips":["Always set druid.host explicitly in containerized/Kubernetes deployments","Ensure the machine hostname resolves in /etc/hosts before startup","Smoke-test hostname resolution in the container image build","Prefer stable service DNS names over ephemeral hostnames"],"tags":["hostname","dns","startup","druid-node","environment"],"backgroundTag":"missing-env-var","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}