{"record":{"id":"f09925745ecd0e80","repo":"apache/beam","slug":"port-must-be-between-1-and-65535-but-was","errorCode":null,"errorMessage":"port must be between 1 and 65535, but was .","messagePattern":"port must be between 1 and 65535, but was \\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/debezium/src/main/java/org/apache/beam/io/debezium/DebeziumReadSchemaTransformProvider.java","lineNumber":230,"sourceCode":"    public abstract int getPort();\n\n    @SchemaFieldDescription(\"Fully qualified table name included in the Debezium change stream.\")\n    public abstract String getTable();\n\n    @SchemaFieldDescription(\n        \"Debezium connector type. Supported values: MYSQL, POSTGRES, SQLSERVER, ORACLE, and DB2.\")\n    public abstract @NonNull String getDatabase();\n\n    @SchemaFieldDescription(\"Additional Debezium connection properties in key=value format.\")\n    public abstract @Nullable List<String> getDebeziumConnectionProperties();\n\n    public void validate() {\n      if (getHost().isEmpty()) {\n        throw new IllegalArgumentException(\"host must not be empty.\");\n      }\n\n      if (getPort() <= 0 || getPort() > 65535) {\n        throw new IllegalArgumentException(\n            \"port must be between 1 and 65535, but was \" + getPort() + \".\");\n      }\n\n      if (getTable().isEmpty()) {\n        throw new IllegalArgumentException(\"table must not be empty.\");\n      }\n\n      List<String> connectionProperties = getDebeziumConnectionProperties();\n      if (connectionProperties != null) {\n        for (String property : connectionProperties) {\n          if (property == null || property.indexOf('=') <= 0) {\n            throw new IllegalArgumentException(\n                \"Invalid Debezium connection property '\"\n                    + property\n                    + \"'. Expected key=value format.\");\n          }\n        }\n      }","sourceCodeStart":212,"sourceCodeEnd":248,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/debezium/src/main/java/org/apache/beam/io/debezium/DebeziumReadSchemaTransformProvider.java#L212-L248","documentation":"Validation guard in DebeziumReadSchemaTransformProvider's configuration: the port field is checked against the valid TCP range and must be an integer between 1 and 65535. An out-of-range or unparsable port supplied in the transform config causes validate() (invoked via from()) to raise this error before any connection is attempted.","triggerScenarios":"Providing port <= 0 or > 65535 in the Debezium read configuration; commonly the port field left at 0 because the option was never set.","commonSituations":"Config placeholder not replaced (port=0), typo like 65356 instead of 6536/3306, or unit confusion (passing milliseconds or a port read from the wrong config key).","solutions":["Set port to the database's actual listening port (e.g. 3306 MySQL, 5432 PostgreSQL, 1433 SQL Server).","Check templated configs for unreplaced placeholders resulting in 0.","Clamp/validate the port at config load time before constructing the transform.","Confirm no trailing characters are parsed into the port value."],"exampleFix":"// before\n.withPort(Integer.parseInt(System.getenv(\"DB_PORT\"))) // unset -> 0\n// after\nint port = Integer.parseInt(Optional.ofNullable(System.getenv(\"DB_PORT\")).orElse(\"3306\"));\nif (port <= 0 || port > 65535) throw new IllegalArgumentException(\"bad port\");\n.withPort(port)","handlingStrategy":"validation","validationCode":"int p = Integer.parseInt(portRaw.trim());\nif (p <= 0 || p > 65535) throw new IllegalArgumentException(\"port must be between 1 and 65535, but was \" + p);","typeGuard":"static boolean validPort(int port) {\n  return port > 0 && port <= 65535;\n}","tryCatchPattern":null,"preventionTips":["Use the database's standard port (3306/5432/1433) unless customized.","Watch for unset configs defaulting to 0.","Parse port as int early and fail fast with the actual value in the message."],"tags":["java","apache-beam","debezium","config-validation","port"],"backgroundTag":"value-out-of-range","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}