apache/seatunnel · error · OptionValidationException

Invalid endpoint port in endpoint: %s

Error message

Invalid endpoint port in endpoint: %s

What it means

Endpoint validation rejects a host:port endpoint whose port segment cannot be parsed as an integer. The host and colon format passed, but Integer.parseInt on the substring after the last ':' threw NumberFormatException, wrapped as OptionValidationException during config validation.

Source

Thrown at seatunnel-connectors-v2/connector-edge-socket/src/main/java/org/apache/seatunnel/connectors/seatunnel/edgesocket/source/EdgeSocketSourceFactory.java:125

        public String description() {
            return "must be blank or in host:port format";
        }

        @Override
        public boolean evaluate(ReadonlyConfig config, String endpoint) {
            if (endpoint == null || endpoint.trim().isEmpty()) {
                return true;
            }
            int separatorIndex = endpoint.lastIndexOf(':');
            if (separatorIndex <= 0 || separatorIndex >= endpoint.length() - 1) {
                throw new OptionValidationException(
                        "Invalid endpoint: %s, expected format host:port", endpoint);
            }
            String endpointPort = endpoint.substring(separatorIndex + 1);
            try {
                Integer.parseInt(endpointPort);
            } catch (NumberFormatException parseException) {
                throw new OptionValidationException(
                        String.format("Invalid endpoint port in endpoint: %s", endpoint),
                        parseException);
            }
            return true;
        }
    }

    private static class SecretKeyValidator implements ConditionExtension<String> {

        @Override
        public String description() {
            return "must decode to exactly 32 bytes when packet_mode is PACKET";
        }

        @Override
        public boolean evaluate(ReadonlyConfig config, String secretKey) {
            if (secretKey == null) {
                return true;

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Set a numeric port, e.g. "edge-node-01:5100".
  2. Trim whitespace and non-printable characters from the endpoint string.
  3. Resolve template/placeholder variables before job submission so no '${...}' remains in the port.
  4. Keep the port within valid range (1-65535).

Example fix

// before
endpoint = "edge-node-01:${PORT}"
// after
endpoint = "edge-node-01:5100"
Defensive patterns

Strategy: validation

Validate before calling

public static boolean isValidEndpoint(String endpoint) {
    if (endpoint == null) return false;
    int i = endpoint.lastIndexOf(':');
    if (i <= 0 || i >= endpoint.length() - 1) return false;
    String port = endpoint.substring(i + 1).trim();
    try { int p = Integer.parseInt(port); return p >= 1 && p <= 65535; }
    catch (NumberFormatException e) { return false; }
}

Try / catch

try {
    factory.apply(config);
} catch (OptionValidationException e) {
    log.error("endpoint port invalid: {}", e.getMessage());
}

Prevention

When it happens

Trigger: evaluate() is given an endpoint like "host:abc", "host:70000" (> Integer range throws NumberFormatException? — values above 2^31-1 fail parse), "host:5100 " (trailing space), or "host:5100x".

Common situations: Non-numeric port typos; port placeholder left unresolved (e.g. "host:${PORT}"); leading/trailing spaces or invisible characters from YAML/clipboard; oversized numeric values from bad templating.

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/8b60c20bf1b38107. Report an issue: GitHub.