SonarSource/sonarqube · error · MessageException

Address in property %s is not a valid address: %s

Error message

Address in property %s is not a valid address: %s

What it means

ClusterSettings.parseAndCheckHosts/parseAndCheckHost validate every host value of a cluster host property by resolving it through the Network.toInetAddress. When one or more hosts cannot be resolved to an IP address, all unresolvable hosts are collected, sorted, and reported in a single MessageException naming the property key and the offending host list.

Source

Thrown at server/sonar-main/src/main/java/org/sonar/application/config/ClusterSettings.java:149

      .map(String::trim)
      .map(ClusterSettings::parseHost)
      .collect(toSet());
  }

  private Set<AddressAndPort> parseAndCheckHosts(Property property, String value) {
    Set<AddressAndPort> res = parseHosts(value);
    checkValidHosts(property, res);
    return res;
  }

  private void checkValidHosts(Property property, Set<AddressAndPort> addressAndPorts) {
    List<String> invalidHosts = addressAndPorts.stream()
      .map(AddressAndPort::getHost)
      .filter(t -> !network.toInetAddress(t).isPresent())
      .sorted()
      .toList();
    if (!invalidHosts.isEmpty()) {
      throw new MessageException(format("Address in property %s is not a valid address: %s",
        property.getKey(), String.join(", ", invalidHosts)));
    }
  }

  private static AddressAndPort parseHost(String value) {
    HostAndPort hostAndPort = HostAndPort.fromString(value);
    return new AddressAndPort(hostAndPort.getHost(), hostAndPort.hasPort() ? hostAndPort.getPort() : null);
  }

  private AddressAndPort parseAndCheckHost(Property property, String value) {
    AddressAndPort addressAndPort = parseHost(value);
    checkValidHosts(property, singleton(addressAndPort));
    return addressAndPort;
  }

  public static NodeType toNodeType(Props props) {
    String nodeTypeValue = requireValue(props, CLUSTER_NODE_TYPE);
    if (!NodeType.isValid(nodeTypeValue)) {

View on GitHub (pinned to 184c821202)

Solutions

  1. Fix or remove the unresolvable hostnames listed in the message under the given property key in conf/sonar.properties.
  2. Verify DNS resolution inside the node: run a lookup (e.g. getent hosts <host>) from the same container/host SonarQube runs on.
  3. If hosts should be plain IPs, use valid IPv4/IPv6 literals; if Kubernetes, confirm the service/host DNS names match the namespace.

Example fix

// before (conf/sonar.properties)
sonar.cluster.hosts=node1.internal,node2.internal,note3.internal

// after (typo fixed)
sonar.cluster.hosts=node1.internal,node2.internal,node3.internal
Defensive patterns

Strategy: validation

Validate before calling

// shell: resolve every host of the property before startup
for h in $(grep '^sonar\.cluster\.hosts' conf/sonar.properties | cut -d= -f2 | tr ',' ' '); do
  getent hosts "$h" >/dev/null || echo "UNRESOLVABLE: $h"
done

Prevention

When it happens

Trigger: checkValidHosts is called after parsing values of properties such as sonar.cluster.hosts, sonar.cluster.search.hosts, or sonar.cluster.es.hosts; it throws when network.toInetAddress(host) returns empty for any host in the comma-separated list.

Common situations: Typo in a hostname in sonar.properties; DNS not resolvable inside a container or Kubernetes pod; using an IP literal format the resolver rejects; referencing a node that was decommissioned.

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.

Related errors


AI-assisted analysis of SonarSource/sonarqube@184c821202 (2026-09-09). Data as JSON: /api/errors/5e264322e2e00090. Report an issue: GitHub.