apache/seatunnel · error · OptionValidationException

nodes[ ]: port ' ' is out of range [ , ]

Error message

nodes[%d]: port '%s' is out of range [%d, %d]

What it means

The Redis connector could not parse the port portion of a `nodes` entry in 'host:port' format as an integer. RedisNodesValidator catches the NumberFormatException from Integer.parseInt and rethrows it as an OptionValidationException reporting the allowed port range. This unifies parse failures and range failures into a clear config error.

Solutions

  1. Correct the port to a numeric value in the valid range (see the range reported in the message, e.g. 1-65535).
  2. Ensure no stray characters follow the port number.
  3. If the port is templated, confirm substitution produced a number.
  4. Quote/escape the node string so shell or YAML parsing doesn't mangle it.

Example fix

// before
nodes = ["127.0.0.1:PORT"]
// after
nodes = ["127.0.0.1:6379"]
Defensive patterns

Strategy: validation

Validate before calling

String portStr = node.substring(node.indexOf(':') + 1);
try { Integer.parseInt(portStr); } catch (NumberFormatException e) {
    throw new IllegalArgumentException("non-numeric port: " + portStr);
}

Prevention

When it happens

Trigger: evaluate() receives a nodes entry like '127.0.0.1:abc', 'host:', or 'host:63790abc' where the substring after the first colon is not a valid decimal integer.

Common situations: Typos in the port, leftover characters after the port (e.g. '6379;'), accidentally using a hostname where the port belongs, or placeholder text like 'host:PORT' that was never substituted.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/0dfd3fd2c37d8117. Report an issue: GitHub.

Appendix: source

Thrown at seatunnel-connectors-v2/connector-redis/src/main/java/org/apache/seatunnel/connectors/seatunnel/redis/config/RedisNodesValidator.java:60

            throws OptionValidationException {
        for (int i = 0; i < value.size(); i++) {
            String node = value.get(i);
            if (node == null || !NODE_PATTERN.matcher(node).matches()) {
                throw new OptionValidationException(
                        "nodes[%d]: must be in 'host:port' format, got: %s", i, node);
            }
            int colon = node.indexOf(':');
            String host = node.substring(0, colon);
            if (host.trim().isEmpty()) {
                throw new OptionValidationException(
                        "nodes[%d]: host must not be blank in 'host:port', got: %s", i, node);
            }
            String portStr = node.substring(colon + 1);
            int port;
            try {
                port = Integer.parseInt(portStr);
            } catch (NumberFormatException e) {
                throw new OptionValidationException(
                        "nodes[%d]: port '%s' is out of range [%d, %d]",
                        i, portStr, RedisBaseOptions.MIN_PORT, RedisBaseOptions.MAX_PORT);
            }
            if (port < RedisBaseOptions.MIN_PORT || port > RedisBaseOptions.MAX_PORT) {
                throw new OptionValidationException(
                        "nodes[%d]: port %d is out of range [%d, %d]",
                        i, port, RedisBaseOptions.MIN_PORT, RedisBaseOptions.MAX_PORT);
            }
        }
        return true;
    }
}

View on GitHub (pinned to cf67b549a7)