{"record":{"id":"08ce9397b2ab9a99","repo":"apache/seatunnel","slug":"transport-endpoint-port-must-be-a-valid-tcp-port","errorCode":null,"errorMessage":"transport.endpoint port must be a valid TCP port (1-65535), got: ${port}","messagePattern":"transport\\.endpoint port must be a valid TCP port \\(1-65535\\), got: (.+?)","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":62,"sourceCode":"        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    }\n}\n","sourceCodeStart":44,"sourceCodeEnd":78,"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#L44-L78","documentation":"Once the port parses as an integer, parseHostAndPort enforces the TCP port range: it must be between 1 and 65535 inclusive. Ports 0 or >65535 throw IllegalArgumentException telling the caller the required valid TCP port range and the value received.","triggerScenarios":"Calling hostPort/validateFormat with endpoints like \"host:0\", \"host:70000\", or \"host:-1\" — syntactically numeric but outside 1..65535.","commonSituations":"Using 0 to mean 'auto-assign' (not supported here); fat-fingering digits to exceed 65535; copy-pasting a container-internal ephemeral range value; negative numbers from subtraction in templated values.","solutions":["Use a port in 1-65535, e.g. \"host:5800\".","If you intended an ephemeral/auto-assigned port, pick an explicit port instead — this parser requires one.","Verify the value source (env var, script arithmetic) yields a number within range.","Check for duplicated digits or concatenation mistakes in generated configs."],"exampleFix":"// before\ntransport.endpoint = \"localhost:70000\"\n\n// after\ntransport.endpoint = \"localhost:5800\"","handlingStrategy":"validation","validationCode":"int port = Integer.parseInt(cfg.getString(\"transport.endpoint\").substring(cfg.getString(\"transport.endpoint\").lastIndexOf(':') + 1));\nif (port < 1 || port > 65535) {\n    throw new IllegalStateException(\"transport.endpoint port must be 1-65535, got: \" + port);\n}","typeGuard":"boolean isValidTcpPort(int port) { return port >= 1 && port <= 65535; }","tryCatchPattern":"try {\n    EdgeTransportEndpoints.validateFormat(endpoint);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"valid TCP port\")) {\n        LOG.error(\"Port out of range in endpoint: \" + endpoint, e);\n    }\n    throw e;\n}","preventionTips":["Clamp or assert port values in the script that generates agent configs.","Reject port 0 explicitly — this parser does not support auto-assignment.","Range-check ports read from env vars before interpolating them into configs.","Keep a checklist of valid port ranges for your deployment environment."],"tags":["config","endpoint","port","range-validation"],"backgroundTag":"value-out-of-range","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}