apache/seatunnel · error · IllegalArgumentException
Invalid endpoint: ${endpoint}, expected format host:port
Error message
Invalid endpoint: ${endpoint}, expected format host:port What it means
parseHostAndPort locates the last ':' in the trimmed endpoint and requires it to have a character on both sides (separatorIndex > 0 and < length-1). If the colon is missing, leading, or trailing, it throws IllegalArgumentException with the offending endpoint and the expected host:port format.
Source
Thrown at seatunnel-edge-agent/seatunnel-edge-agent-transport/src/main/java/org/apache/seatunnel/edge/agent/transport/config/EdgeTransportEndpoints.java:49
public static void validateFormat(String endpoint) {
parseHostAndPort(endpoint);
}
/** Resolves {@code endpoint} to a socket address for {@link EdgeTransportClient}. */
public static InetSocketAddress toSocketAddress(String endpoint) {
HostPort hostPort = parseHostAndPort(endpoint);
return new InetSocketAddress(hostPort.host, hostPort.port);
}
private static HostPort parseHostAndPort(String endpoint) {
Objects.requireNonNull(endpoint, "endpoint");
String trimmed = endpoint.trim();
if (trimmed.isEmpty()) {
throw new IllegalArgumentException("transport.endpoint must be non-empty.");
}
int separatorIndex = trimmed.lastIndexOf(':');
if (separatorIndex <= 0 || separatorIndex >= trimmed.length() - 1) {
throw new IllegalArgumentException(
"Invalid endpoint: " + endpoint + ", expected format host:port");
}
String host = trimmed.substring(0, separatorIndex);
String portText = trimmed.substring(separatorIndex + 1);
int port;
try {
port = Integer.parseInt(portText);
} catch (NumberFormatException parseException) {
throw new IllegalArgumentException(
"Invalid endpoint port in endpoint: " + endpoint, parseException);
}
if (port < 1 || port > 65535) {
throw new IllegalArgumentException(
"transport.endpoint port must be a valid TCP port (1-65535), got: " + port);
}
return new HostPort(host, port);
}
View on GitHub (pinned to cf67b549a7)
Solutions
- Write the endpoint as host:port with both parts non-empty, e.g. "10.0.0.5:5800".
- Strip any protocol scheme or path so only host:port remains.
- If port is implied, state it explicitly; the parser does not apply defaults.
- For hostnames, confirm the string has exactly the intended single colon separating host and numeric port.
Example fix
// before transport.endpoint = "localhost" // after transport.endpoint = "localhost:5800"
Defensive patterns
Strategy: validation
Validate before calling
String endpoint = cfg.getString("transport.endpoint").trim();
int idx = endpoint.lastIndexOf(':');
if (idx <= 0 || idx >= endpoint.length() - 1) {
throw new IllegalStateException("transport.endpoint must be host:port, got: " + endpoint);
} Type guard
boolean looksLikeHostPort(String s) {
String t = s == null ? "" : s.trim();
int i = t.lastIndexOf(':');
return i > 0 && i < t.length() - 1;
} Try / catch
try {
EdgeTransportEndpoints.validateFormat(endpoint);
} catch (IllegalArgumentException e) {
LOG.error("Endpoint must be in host:port form: " + endpoint, e);
throw e;
} Prevention
- Always include an explicit numeric port when writing endpoints.
- Strip URL schemes and paths before assigning values to transport.endpoint.
- Add a lint rule that endpoints match ^[^:]+:[0-9]+$.
- Quote endpoint strings in HOCON to avoid parser quirks.
When it happens
Trigger: Calling EdgeTransportEndpoints.hostPort/validateFormat with endpoints like "localhost", ":8080", "host:", or "host:port:extra" where lastIndexOf(':') fails the position checks.
Common situations: Forgetting the port in a copied URL; including a scheme like "http://host:8080" is fine but "tcp:host" style prefixes without colon placement break; trailing colons from template concatenation; IPv6 unbracketed literals in exotic cases.
Understand the failure class
Background: "Invalid URL" errors: why new URL(), URI.parse, and reqwest::Url reject your string — missing scheme, whitespace, and bad path format — this error's family across 39 libraries.
Related errors
- Invalid endpoint: %s, expected format host:port
- Invalid endpoint port in endpoint: ${endpoint}
- UNSUPPORTED_DATA_TYPE
- UNSUPPORTED_DATA_TYPE
- The server id range should be syntax like '5400-5500', but g
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/df16b96da5d09e7d.
Report an issue: GitHub.