{"record":{"id":"a427f64f58847835","repo":"SonarSource/sonarqube","slug":"can-not-resolve-host-please-check-network-setti","errorCode":null,"errorMessage":"Can not resolve host [. Please check network settings and property ","messagePattern":"Can not resolve host \\[\\. Please check network settings and property ","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"server/sonar-main/src/main/java/org/sonar/application/es/EsSettings.java","lineNumber":206,"sourceCode":"  private InetAddress resolveAddress(ProcessProperties.Property prop) {\n    return resolveAddress(prop, null);\n  }\n\n  private InetAddress resolveAddress(ProcessProperties.Property prop, @Nullable InetAddress defaultAddress) {\n    String address;\n    if (defaultAddress == null) {\n      address = props.nonNullValue(prop.getKey());\n    } else {\n      address = props.value(prop.getKey());\n      if (address == null) {\n        return defaultAddress;\n      }\n    }\n\n    try {\n      return InetAddress.getByName(address);\n    } catch (UnknownHostException e) {\n      throw new IllegalStateException(\"Can not resolve host [\" + address + \"]. Please check network settings and property \" + prop.getKey(), e);\n    }\n  }\n\n  private void configureCluster(Map<String, String> builder) {\n    // Default value in a standalone mode, not overridable\n\n    String initialStateTimeOut = \"30s\";\n\n    if (clusterEnabled) {\n      initialStateTimeOut = props.value(SEARCH_INITIAL_STATE_TIMEOUT.getKey(), \"120s\");\n\n      String nodeSearchHost = resolveAddress(CLUSTER_NODE_SEARCH_HOST, loopbackAddress).getHostAddress();\n      int nodeSearchPort = props.valueAsInt(CLUSTER_NODE_SEARCH_PORT.getKey(), 9001);\n      builder.put(ES_HTTP_HOST_KEY, nodeSearchHost);\n      builder.put(ES_HTTP_PORT_KEY, valueOf(nodeSearchPort));\n\n      String nodeTransportHost = resolveAddress(CLUSTER_NODE_ES_HOST, loopbackAddress).getHostAddress();\n      int nodeTransportPort = props.valueAsInt(CLUSTER_NODE_ES_PORT.getKey(), 9002);","sourceCodeStart":188,"sourceCodeEnd":224,"githubUrl":"https://github.com/SonarSource/sonarqube/blob/184c821202192afc1c599fc912d0889b69fffa53/server/sonar-main/src/main/java/org/sonar/application/es/EsSettings.java#L188-L224","documentation":"resolveAddress converts a configured host name into an InetAddress for ES network settings. If InetAddress.getByName cannot resolve the host it throws this IllegalStateException advising to check network settings and the relevant sonar property (e.g. sonar.search.host / node transport host).","triggerScenarios":"sonar.search.host, sonar.cluster.node.host, or the transport host property contains a hostname DNS cannot resolve, or an invalid literal address, at ES settings build time.","commonSituations":"Typo in hostname in sonar.properties; DNS not available in the container/K8s pod; using a hostname before the service record exists; configuring 0.0.0.0-style values incorrectly.","solutions":["Fix the host property reported in the message to a resolvable hostname or a valid IP address","Verify DNS resolution from the server host: `getent hosts <name>` or `nslookup <name>`","In containers/clusters, use the service DNS name or pod IP and ensure it is registered before SonarQube starts","Use 0.0.0.0 only where binding-all-interfaces is intended; prefer explicit interface addresses"],"exampleFix":"# before\nsonar.search.host=search.internal.example   # unresolvable\n# after\nsonar.search.host=192.168.1.25   # or fix DNS for search.internal.example","handlingStrategy":"validation","validationCode":"// Verify resolvability before startup\nInetAddress a = InetAddress.getByName(props.get(\"sonar.search.host\")); // throws UnknownHostException early, with clear context\nlog.info(\"sonar.search.host resolves to {}\", a.getHostAddress());","typeGuard":null,"tryCatchPattern":"try { InetAddress.getByName(host); } catch (UnknownHostException e) { throw new IllegalStateException(\"Unresolvable host configured: \" + host, e); }","preventionTips":["Test DNS from the server host (getent hosts) before starting","Use IP addresses where DNS is unreliable (bare containers, early boot)","In Kubernetes, verify the Service DNS record exists before app start (initContainers/wait-for)","Keep host properties consistent between web and search nodes"],"tags":["elasticsearch","dns","network","configuration"],"backgroundTag":"connection-refused","analyzedSha":"184c821202192afc1c599fc912d0889b69fffa53","analyzedAt":"2026-09-09T12:23:51.573Z","contentChangedAt":"2026-09-09T12:23:51.573Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}