apache/seatunnel · error · NumberFormatException

port must be positive

Error message

port must be positive

What it means

Within validateNode, the port substring is parsed with Integer.parseInt and must be > 0; a zero or negative port raises NumberFormatException("port must be positive"), which is caught and rethrown as the invalid host:port CONFIG_VALIDATION_FAILED error (869). The bare message here is the internal sentinel; users normally see the wrapped message.

Source

Thrown at seatunnel-connectors-v2/connector-doris/src/main/java/org/apache/seatunnel/connectors/doris/sink/writer/DorisNodeResolver.java:68

        if (StringUtils.isBlank(node)) {
            throw new DorisConnectorException(
                    SeaTunnelAPIErrorCode.CONFIG_VALIDATION_FAILED,
                    String.format(
                            "PluginName: Doris, Message: Option '%s' contains a blank node entry.",
                            optionName));
        }
        int splitIndex = node.lastIndexOf(':');
        if (splitIndex <= 0 || splitIndex == node.length() - 1) {
            throw new DorisConnectorException(
                    SeaTunnelAPIErrorCode.CONFIG_VALIDATION_FAILED,
                    String.format(
                            "PluginName: Doris, Message: Option '%s' contains invalid host:port value '%s'.",
                            optionName, node));
        }
        try {
            int port = Integer.parseInt(node.substring(splitIndex + 1));
            if (port <= 0) {
                throw new NumberFormatException("port must be positive");
            }
        } catch (NumberFormatException e) {
            throw new DorisConnectorException(
                    SeaTunnelAPIErrorCode.CONFIG_VALIDATION_FAILED,
                    String.format(
                            "PluginName: Doris, Message: Option '%s' contains invalid host:port value '%s'.",
                            optionName, node));
        }
    }
}

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Change the port to a positive integer matching the actual Doris port (FE http 8030 / BE http 8040 by default)
  2. Validate the option value with a quick regex (^[^:]+:[0-9]+$) before submitting the job
  3. Fix the config generator/template that emitted a 0 or negative port

Example fix

// before
frontends = "doris-fe:0";
// after
frontends = "doris-fe:8030";
Defensive patterns

Strategy: validation

Validate before calling

final int port = Integer.parseInt(node.substring(node.lastIndexOf(':') + 1));
if (port <= 0 || port > 65535) throw new IllegalArgumentException("invalid port in " + node);

Prevention

When it happens

Trigger: A node entry like "fe1:0" or "fe1:-1" — port parses as an int but is <= 0.

Common situations: Placeholder ports left as 0 in generated configs; negative values from bad templating math; typo such as "fe1:803o" would instead hit the parse-number path (869).

Understand the failure class

Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.

Related errors


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