alibaba/nacos · error · RuntimeException

nacos address

Error message

nacos address 

What it means

Thrown by InetUtils.getNacosIp() when the configured Nacos address (from system property nacos.server.ip or Spring property nacos.inetutils.ip-address) is neither a valid IP nor a valid domain. Unlike the gRPC variant, a domain is accepted here.

Source

Thrown at sys/src/main/java/com/alibaba/nacos/sys/utils/InetUtils.java:149

        }
        selfIP = tmpSelfIp;
    }
    
    /**
     * Get ip address from environment
     * System property nacos.server.ip
     * Spring property nacos.inetutils.ip-address.
     *
     * @return ip address
     */
    public static String getNacosIp() {
        String nacosIp = System.getProperty(NACOS_SERVER_IP);
        if (StringUtils.isBlank(nacosIp)) {
            nacosIp = EnvUtil.getProperty(IP_ADDRESS);
        }
        if (!StringUtils.isBlank(nacosIp)) {
            if (!(InternetAddressUtil.isIp(nacosIp) || InternetAddressUtil.isDomain(nacosIp))) {
                throw new RuntimeException("nacos address " + nacosIp + " is not ip");
            }
        }
        
        return nacosIp;
    }
    
    /**
     * Get ip address.
     *
     * @return ip address
     */
    private static String getPreferHostnameOverIP() {
        preferHostnameOverIP = Boolean.getBoolean(SYSTEM_PREFER_HOSTNAME_OVER_IP);
        
        if (!preferHostnameOverIP) {
            preferHostnameOverIP =
                Boolean.parseBoolean(EnvUtil.getProperty(PREFER_HOSTNAME_OVER_IP));
        }

View on GitHub (pinned to 9b989acdf1)

Solutions

  1. Correct nacos.server.ip / nacos.inetutils.ip-address to a valid IP or resolvable hostname.
  2. Trim whitespace and remove stray characters from the value.
  3. Validate the value parses as an IP (InternetAddressUtil.isIp) before startup.
  4. Check the config source (env var, configmap) for templating errors.

Example fix

# before
nacos.inetutils.ip-address=192.168.1.1   
# (trailing space -> not ip, not domain)

# after
nacos.inetutils.ip-address=192.168.1.1
Defensive patterns

Strategy: validation

Validate before calling

String ip = System.getProperty("nacos.server.ip");
if (ip != null && !ip.isBlank()
        && !InternetAddressUtil.isIp(ip) && !InternetAddressUtil.isDomain(ip)) {
    throw new IllegalArgumentException("Invalid nacos address: " + ip);
}

Try / catch

try {
    String ip = InetUtils.getNacosIp();
} catch (RuntimeException e) {
    if (e.getMessage() != null && e.getMessage().contains("is not ip")) {
        // fix nacos.server.ip / nacos.inetutils.ip-address
    }
    throw e;
}

Prevention

When it happens

Trigger: StringUtils.isBlank(nacosIp) is false but InternetAddressUtil.isIp(nacosIp) and isDomain(nacosIp) both return false — the value contains invalid characters, spaces, or is otherwise malformed.

Common situations: Typo in nacos.inetutils.ip-address (e.g. trailing space, '192.168.1.1 ' or '192.168.1'); value set to something that is neither an IP nor a hostname; config templating injected a malformed value.

Related errors


AI-assisted analysis of alibaba/nacos@9b989acdf1 (2026-08-14). Data as JSON: /api/errors/a14523260dd35f03. Report an issue: GitHub.