apache/incubator-seata · error · IllegalArgumentException

ip and port string cannot be empty!

Error message

ip and port string cannot be empty!

What it means

NetUtil.splitIPPortStr parses an "ip:port" (or "[ipv6]:port") address string. It rejects a null, empty, or whitespace-only address with IllegalArgumentException because there is nothing to split into host and port. Callers such as toInetSocketAddress rely on it for address parsing.

Source

Thrown at common/src/main/java/org/apache/seata/common/util/NetUtil.java:134

     * @return the inet socket address
     */
    public static InetSocketAddress toInetSocketAddress(String address) {
        String[] ipPortStr = splitIPPortStr(address);
        String host;
        int port;
        if (null != ipPortStr) {
            host = ipPortStr[0];
            port = Integer.parseInt(ipPortStr[1]);
        } else {
            host = address;
            port = 0;
        }
        return new InetSocketAddress(host, port);
    }

    public static String[] splitIPPortStr(String address) {
        if (StringUtils.isBlank(address)) {
            throw new IllegalArgumentException("ip and port string cannot be empty!");
        }
        if (address.charAt(0) == '[') {
            address = removeBrackets(address);
        }
        int i = address.lastIndexOf(Constants.IP_PORT_SPLIT_CHAR);
        if (i > -1) {
            String hostAddress = address.substring(0, i);
            if (hostAddress.contains("%")) {
                hostAddress = hostAddress.substring(0, hostAddress.indexOf("%"));
            }
            String portStr = address.substring(i + 1);
            if (StringUtils.isBlank(hostAddress) || StringUtils.isBlank(portStr)) {
                throw new IllegalArgumentException(
                        "Invalid endpoint format: " + address + ". Endpoint should be in the format ip:port.");
            }
            try {
                int port = Integer.parseInt(portStr);
                if (port < 1 || port > 65535) {

View on GitHub (pinned to e01f97c6db)

Solutions

  1. Populate the address property with a valid host:port, e.g. 127.0.0.1:8091
  2. Check for blank address before parsing and report which config key is empty
  3. Log all resolved addresses at startup

Example fix

// before
InetSocketAddress addr = NetUtil.toInetSocketAddress(address);

// after
if (StringUtils.isBlank(address)) throw new IllegalStateException("address not configured (check grouplist/registry config)");
InetSocketAddress addr = NetUtil.toInetSocketAddress(address);
Defensive patterns

Strategy: validation

Validate before calling

if (StringUtils.isBlank(address)) throw new ConfigurationException("address is blank; check registry/grouplist config");
NetUtil.splitIPPortStr(address);

Prevention

When it happens

Trigger: Calling NetUtil.splitIPPortStr(address), toInetSocketAddress(address), or toLong(address) with a blank string — usually a registry/group address property (e.g. 127.0.0.1:8091 style value) that was never set or resolved to empty.

Common situations: Missing grouplist/registry address in seata config (e.g. service.default.grouplist left blank), or a config lookup returning "" that is passed straight into address parsing.

Related errors


AI-assisted analysis of apache/incubator-seata@e01f97c6db (2026-08-14). Data as JSON: /api/errors/d2e0f3762e8f0610. Report an issue: GitHub.