apache/seatunnel · error · OptionValidationException

Invalid endpoint: %s, expected format host:port

Error message

Invalid endpoint: %s, expected format host:port

What it means

Endpoint validation in EdgeSocketSourceFactory's OptionValidation rule rejects an endpoint string that does not follow host:port. The check requires a ':' separator that is neither the first character nor the last character of the string. Thrown as OptionValidationException during config validation, before the job starts.

Source

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

    public Class<? extends SeaTunnelSource> getSourceClass() {
        return EdgeSocketSource.class;
    }

    private static class EndpointValidator implements ConditionExtension<String> {

        @Override
        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() {

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Write the endpoint as host:port, e.g. "192.168.1.10:5100".
  2. If using IPv6, bracket the host or use an address form compatible with the host:port parsing (lastIndexOf ':'), e.g. use a resolvable hostname instead of a raw IPv6 literal.
  3. Trim whitespace and remove stray characters from the configured endpoint value.
  4. Check the config file/CLI value for truncation (e.g. port lost during templating).

Example fix

// before
endpoint = "edge-node-01"
// 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;
    try { Integer.parseInt(endpoint.substring(i + 1)); return true; }
    catch (NumberFormatException e) { return false; }
}

Try / catch

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

Prevention

When it happens

Trigger: evaluate() is called with an endpoint like "host" (no colon), ":8080" (empty host), "host:" (empty port), or "host:port:extra" where lastIndexOf(':') yields an unusable split.

Common situations: Typing just a hostname without a port; copying an IPv6 literal like ::1 (colons confuse lastIndexOf-based parsing); trailing whitespace leaving an empty port segment; accidentally pasting a URL instead of host:port.

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/04e87bcc80123f90. Report an issue: GitHub.