{"record":{"id":"6b4aea15324c14b7","repo":"apache/incubator-seata","slug":"invalid-endpoint-format-address-endpoin","errorCode":null,"errorMessage":"\"Invalid endpoint format: \" + address + \". Endpoint should be in the format ip:port.\"","messagePattern":"\"Invalid endpoint format: \" \\+ address \\+ \"\\. Endpoint should be in the format ip:port\\.\"","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"common/src/main/java/org/apache/seata/common/util/NetUtil.java","lineNumber":147,"sourceCode":"        return new InetSocketAddress(host, port);\n    }\n\n    public static String[] splitIPPortStr(String address) {\n        if (StringUtils.isBlank(address)) {\n            throw new IllegalArgumentException(\"ip and port string cannot be empty!\");\n        }\n        if (address.charAt(0) == '[') {\n            address = removeBrackets(address);\n        }\n        int i = address.lastIndexOf(Constants.IP_PORT_SPLIT_CHAR);\n        if (i > -1) {\n            String hostAddress = address.substring(0, i);\n            if (hostAddress.contains(\"%\")) {\n                hostAddress = hostAddress.substring(0, hostAddress.indexOf(\"%\"));\n            }\n            String portStr = address.substring(i + 1);\n            if (StringUtils.isBlank(hostAddress) || StringUtils.isBlank(portStr)) {\n                throw new IllegalArgumentException(\n                        \"Invalid endpoint format: \" + address + \". Endpoint should be in the format ip:port.\");\n            }\n            try {\n                int port = Integer.parseInt(portStr);\n                if (port < 1 || port > 65535) {\n                    throw new IllegalArgumentException(\n                            \"Invalid endpoint format: \" + address + \". Port must be between 1 and 65535.\");\n                }\n            } catch (NumberFormatException e) {\n                throw new IllegalArgumentException(\n                        \"Invalid endpoint format: \" + address + \". Port must be a numeric value.\", e);\n            }\n\n            return new String[] {hostAddress, portStr};\n        } else {\n            throw new IllegalArgumentException(\n                    \"Invalid endpoint format: \" + address + \". Endpoint should be in the format ip:port.\");\n        }","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/apache/incubator-seata/blob/e01f97c6db397165050caa6764020410c2c8199a/common/src/main/java/org/apache/seata/common/util/NetUtil.java#L129-L165","documentation":"After splitting an address on the last ':' (colon), NetUtil.splitIPPortStr requires both a non-blank host part and a non-blank port part. This IllegalArgumentException (\"Invalid endpoint format ... Endpoint should be in the format ip:port\") fires when one side is empty: an address like \":8091\" (no host) or \"localhost:\" (no port).","triggerScenarios":"Calling splitIPPortStr / toInetSocketAddress with strings such as \":8091\", \"host:\", or where the only colon produced an empty segment. IPv6 addresses without brackets (e.g. \"::1:8091\") can also mis-split because lastIndexOf(':') finds a colon inside the address, yielding a garbage host and non-numeric or blank port.","commonSituations":"Manually edited registry addresses with a typo, templated config that substitutes an empty host variable (\"${HOST}:8091\" with HOST unset), or unbracketed IPv6 literals.","solutions":["Fix the address to a full ip:port (or [ipv6]:port) form","Wrap IPv6 literals in square brackets: [::1]:8091","Quote/escape YAML values so colons are not mangled; ensure template variables resolve"],"exampleFix":"# before (config)\naddress = \":8091\"\n\n# after\naddress = \"127.0.0.1:8091\"","handlingStrategy":"validation","validationCode":"private static final Pattern EP = Pattern.compile(\"^\\\\[?[\\\\w.%:]+\\\\]?:\\\\d+$\");\nif (!EP.matcher(address).matches()) throw new IllegalArgumentException(\"bad endpoint: \" + address);","typeGuard":null,"tryCatchPattern":"try { parts = NetUtil.splitIPPortStr(a); } catch (IllegalArgumentException e) { log.warn(\"skipping malformed endpoint {}\", a); }","preventionTips":["Always include both host and port in address config","Bracket IPv6 literals","Validate endpoint lists with a regex before passing them to Seata"],"tags":["network","address-parsing","ipv6","config"],"backgroundTag":null,"analyzedSha":"e01f97c6db397165050caa6764020410c2c8199a","analyzedAt":"2026-08-14T10:23:53.097Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}