{"record":{"id":"25f07cd707692f8e","repo":"apache/beam","slug":"host-must-not-be-empty","errorCode":null,"errorMessage":"host must not be empty.","messagePattern":"host must not be empty\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/debezium/src/main/java/org/apache/beam/io/debezium/DebeziumReadSchemaTransformProvider.java","lineNumber":226,"sourceCode":"    @SchemaFieldDescription(\"Hostname of the source database.\")\n    public abstract String getHost();\n\n    @SchemaFieldDescription(\"Port of the source database.\")\n    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","sourceCodeStart":208,"sourceCodeEnd":244,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/debezium/src/main/java/org/apache/beam/io/debezium/DebeziumReadSchemaTransformProvider.java#L208-L244","documentation":"The Debezium read configuration validate() rejects an empty host because Debezium cannot establish a database connection without it. It throws IllegalArgumentException when getHost() returns an empty string.","triggerScenarios":"Building the Debezium read SchemaTransform via from(...)/builder without setting host, or setting it to \"\"; validate() is invoked during from().","commonSituations":"YAML/SQL transform configs missing the host key, environment-specific config not injected (empty env var substituted), or constructor built programmatically with the host omitted.","solutions":["Set the host option to the database server hostname or IP before calling from()/expansion.","Check that the templated config (YAML/SQL) actually supplies the host parameter.","Guard empty environment-variable substitution at deploy time.","Run validate() yourself in a pre-flight config check to fail fast with a clear message."],"exampleFix":"// before\nDebeziumRead.getConnector(\"MYSQL\").withPort(3306).withUsername(\"u\").withPassword(\"p\") // no host\n// after\nDebeziumRead.getConnector(\"MYSQL\").withHost(\"db.example.com\").withPort(3306).withUsername(\"u\").withPassword(\"p\")","handlingStrategy":"validation","validationCode":"if (host == null || host.isBlank()) throw new IllegalArgumentException(\"host must be set before building the Debezium read\");","typeGuard":"static boolean hasHost(DebeziumReadConfiguration c) {\n  return c.getHost() != null && !c.getHost().isEmpty();\n}","tryCatchPattern":"try {\n  DebeziumReadSchemaTransformProvider.DebeziumReadConfiguration.from(host, port, user, pass, table, connector);\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().contains(\"host must not be empty\")) {\n    throw new ConfigException(\"Set the database host in the pipeline config\");\n  }\n  throw e;\n}","preventionTips":["Always set host explicitly; never rely on defaults.","Check templated configs for unreplaced ${HOST} placeholders at deploy time.","Run validate() as a pre-flight step in config loading."],"tags":["java","apache-beam","debezium","config-validation"],"backgroundTag":"missing-required-config-field","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"}