{"record":{"id":"a14523260dd35f03","repo":"alibaba/nacos","slug":"nacos-address","errorCode":null,"errorMessage":"nacos address ","messagePattern":"nacos address ","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"sys/src/main/java/com/alibaba/nacos/sys/utils/InetUtils.java","lineNumber":149,"sourceCode":"        }\n        selfIP = tmpSelfIp;\n    }\n    \n    /**\n     * Get ip address from environment\n     * System property nacos.server.ip\n     * Spring property nacos.inetutils.ip-address.\n     *\n     * @return ip address\n     */\n    public static String getNacosIp() {\n        String nacosIp = System.getProperty(NACOS_SERVER_IP);\n        if (StringUtils.isBlank(nacosIp)) {\n            nacosIp = EnvUtil.getProperty(IP_ADDRESS);\n        }\n        if (!StringUtils.isBlank(nacosIp)) {\n            if (!(InternetAddressUtil.isIp(nacosIp) || InternetAddressUtil.isDomain(nacosIp))) {\n                throw new RuntimeException(\"nacos address \" + nacosIp + \" is not ip\");\n            }\n        }\n        \n        return nacosIp;\n    }\n    \n    /**\n     * Get ip address.\n     *\n     * @return ip address\n     */\n    private static String getPreferHostnameOverIP() {\n        preferHostnameOverIP = Boolean.getBoolean(SYSTEM_PREFER_HOSTNAME_OVER_IP);\n        \n        if (!preferHostnameOverIP) {\n            preferHostnameOverIP =\n                Boolean.parseBoolean(EnvUtil.getProperty(PREFER_HOSTNAME_OVER_IP));\n        }","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/sys/src/main/java/com/alibaba/nacos/sys/utils/InetUtils.java#L131-L167","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before\nnacos.inetutils.ip-address=192.168.1.1   \n# (trailing space -> not ip, not domain)\n\n# after\nnacos.inetutils.ip-address=192.168.1.1","handlingStrategy":"validation","validationCode":"String ip = System.getProperty(\"nacos.server.ip\");\nif (ip != null && !ip.isBlank()\n        && !InternetAddressUtil.isIp(ip) && !InternetAddressUtil.isDomain(ip)) {\n    throw new IllegalArgumentException(\"Invalid nacos address: \" + ip);\n}","typeGuard":null,"tryCatchPattern":"try {\n    String ip = InetUtils.getNacosIp();\n} catch (RuntimeException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"is not ip\")) {\n        // fix nacos.server.ip / nacos.inetutils.ip-address\n    }\n    throw e;\n}","preventionTips":["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."],"tags":["sys","network","configuration","startup","inet"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}