{"record":{"id":"8509c36fdb69f7bf","repo":"apache/incubator-seata","slug":"invalid-endpoint-format-address-port-mu-8509c3","errorCode":null,"errorMessage":"\"Invalid endpoint format: \" + address + \". Port must be a numeric value.\"","messagePattern":"\"Invalid endpoint format: \" \\+ address \\+ \"\\. Port must be a numeric value\\.\"","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"common/src/main/java/org/apache/seata/common/util/NetUtil.java","lineNumber":157,"sourceCode":"        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        }\n    }\n\n    /**\n     * To long long.\n     *\n     * @param address the address\n     * @return the long\n     */\n    public static long toLong(String address) {\n        InetSocketAddress ad = toInetSocketAddress(address);","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/apache/incubator-seata/blob/e01f97c6db397165050caa6764020410c2c8199a/common/src/main/java/org/apache/seata/common/util/NetUtil.java#L139-L175","documentation":"NetUtil.splitIPPortStr requires the port substring after the last colon to be a pure integer. When Integer.parseInt(portStr) throws NumberFormatException, it is rethrown as IllegalArgumentException(\"Invalid endpoint format ... Port must be a numeric value\") with the original cause attached.","triggerScenarios":"Calling splitIPPortStr/toInetSocketAddress with a non-numeric port: \"host:http\", \"host:80 91\", or an unbracketed IPv6 literal like \"fe80::1:8091\" where the last colon splits inside the address and the tail is not a plain number. Also URLs including a scheme (\"http://host:8091\") mis-split so the port part becomes \"//host:8091\"-derived garbage.","commonSituations":"Passing full URLs instead of host:port, unbracketed IPv6 addresses, trailing whitespace or units in the port (\"8091 \"), and YAML unquoted values where ': ' parsing corrupts the string.","solutions":["Pass only host:port — strip any scheme such as http:// before parsing","Bracket IPv6 addresses: [fe80::1]:8091","Trim whitespace and remove non-digit characters from the port segment"],"exampleFix":"// before\nNetUtil.splitIPPortStr(\"http://127.0.0.1:8091\");\n\n// after\nString a = \"http://127.0.0.1:8091\".replaceFirst(\"^https?://\", \"\");\nNetUtil.splitIPPortStr(a);","handlingStrategy":"validation","validationCode":"String[] parts = address.split(\":\");\nif (!parts[parts.length - 1].matches(\"\\\\d+\")) throw new IllegalArgumentException(\"port not numeric: \" + address);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Strip URL schemes before parsing endpoints","Bracket IPv6 addresses","Trim config values to avoid hidden whitespace in ports"],"tags":["network","port","address-parsing","ipv6"],"backgroundTag":null,"analyzedSha":"e01f97c6db397165050caa6764020410c2c8199a","analyzedAt":"2026-08-14T10:23:53.097Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}