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
- Correct nacos.server.ip / nacos.inetutils.ip-address to a valid IP or resolvable hostname.
- Trim whitespace and remove stray characters from the value.
- Validate the value parses as an IP (InternetAddressUtil.isIp) before startup.
- 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
- Set nacos.inetutils.ip-address to a valid IP or resolvable hostname.
- Trim whitespace from the value.
- Validate the address with InternetAddressUtil at deploy time.
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
- Cannot get LocalHost InetAddress, please check your network!
- processors multiple must upper than 1
- processors scale must between 0 and 1
- Must be a file directory :
- serverList is empty,please check configuration
AI-assisted analysis of alibaba/nacos@9b989acdf1 (2026-08-14).
Data as JSON: /api/errors/a14523260dd35f03.
Report an issue: GitHub.