{"record":{"id":"dc86c34d50b0776e","repo":"apache/seatunnel","slug":"invalid-endpoint-port-in-endpoint-endpoint","errorCode":null,"errorMessage":"Invalid endpoint port in endpoint: ${endpoint}","messagePattern":"Invalid endpoint port in endpoint: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"seatunnel-edge-agent/seatunnel-edge-agent-transport/src/main/java/org/apache/seatunnel/edge/agent/transport/config/EdgeTransportEndpoints.java","lineNumber":58,"sourceCode":"\n    private static HostPort parseHostAndPort(String endpoint) {\n        Objects.requireNonNull(endpoint, \"endpoint\");\n        String trimmed = endpoint.trim();\n        if (trimmed.isEmpty()) {\n            throw new IllegalArgumentException(\"transport.endpoint must be non-empty.\");\n        }\n        int separatorIndex = trimmed.lastIndexOf(':');\n        if (separatorIndex <= 0 || separatorIndex >= trimmed.length() - 1) {\n            throw new IllegalArgumentException(\n                    \"Invalid endpoint: \" + endpoint + \", expected format host:port\");\n        }\n        String host = trimmed.substring(0, separatorIndex);\n        String portText = trimmed.substring(separatorIndex + 1);\n        int port;\n        try {\n            port = Integer.parseInt(portText);\n        } catch (NumberFormatException parseException) {\n            throw new IllegalArgumentException(\n                    \"Invalid endpoint port in endpoint: \" + endpoint, parseException);\n        }\n        if (port < 1 || port > 65535) {\n            throw new IllegalArgumentException(\n                    \"transport.endpoint port must be a valid TCP port (1-65535), got: \" + port);\n        }\n        return new HostPort(host, port);\n    }\n\n    private static final class HostPort {\n        private final String host;\n        private final int port;\n\n        HostPort(String host, int port) {\n            this.host = host;\n            this.port = port;\n        }\n    }","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-edge-agent/seatunnel-edge-agent-transport/src/main/java/org/apache/seatunnel/edge/agent/transport/config/EdgeTransportEndpoints.java#L40-L76","documentation":"After splitting on the last ':', the port substring is converted with Integer.parseInt. A NumberFormatException (non-numeric port text) is rethrown as IllegalArgumentException with the original endpoint and the parse exception as cause. Valid syntax is host:port where port is a decimal integer.","triggerScenarios":"Calling hostPort/validateFormat with an endpoint whose port section is non-numeric, e.g. \"localhost:http\", \"host:5800x\", or \"host:80,90\".","commonSituations":"Pasting a service name instead of a port; placeholder not substituted (\"host:${PORT}\" with a bad render); whitespace or comma-separated port lists; copying \"host:port\" literally from docs.","solutions":["Replace the port section with a plain decimal integer, e.g. \"localhost:5800\".","Resolve any unresolved config placeholders so the port is numeric in the rendered file.","Strip whitespace, commas, or units (e.g. '8080/tcp') from the port text.","Check the IllegalArgumentException cause (NumberFormatException) in logs to see the exact bad port text."],"exampleFix":"// before\ntransport.endpoint = \"localhost:${PORT}\"\n\n// after\ntransport.endpoint = \"localhost:5800\"","handlingStrategy":"validation","validationCode":"String endpoint = cfg.getString(\"transport.endpoint\").trim();\nString portText = endpoint.substring(endpoint.lastIndexOf(':') + 1);\ntry {\n    Integer.parseInt(portText);\n} catch (NumberFormatException e) {\n    throw new IllegalStateException(\"Port in transport.endpoint must be numeric, got: \" + portText, e);\n}","typeGuard":"boolean hasNumericPort(String endpoint) {\n    String port = endpoint.substring(endpoint.lastIndexOf(':') + 1).trim();\n    return port.chars().allMatch(Character::isDigit) && !port.isEmpty();\n}","tryCatchPattern":"try {\n    EdgeTransportEndpoints.validateFormat(endpoint);\n} catch (IllegalArgumentException e) {\n    if (e.getCause() instanceof NumberFormatException) {\n        LOG.error(\"Non-numeric port in endpoint: \" + endpoint, e);\n    }\n    throw e;\n}","preventionTips":["Never put service names or placeholders in the port position; resolve them first.","Render configs through a strict templater that substitutes numeric ports only.","Trim whitespace and split multi-port lists before configuring a single endpoint.","Log the raw endpoint string when validation fails to spot unrendered placeholders."],"tags":["config","endpoint","parsing","number-format"],"backgroundTag":"invalid-argument-format","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}