{"record":{"id":"77da82eb5af6083a","repo":"apache/beam","slug":"configuration-schema-provided-does-not-match-expected","errorCode":null,"errorMessage":"Configuration schema provided does not match expected","messagePattern":"Configuration schema provided does not match expected","errorType":"validation","errorClass":"InvalidConfigurationException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/pubsub/PubsubSchemaIOProvider.java","lineNumber":178,"sourceCode":"              + \"CREATE TABLE for Pubsub topic must not be null\");\n    }\n    if (!PubsubSchemaIO.fieldPresent(schema, TIMESTAMP_FIELD, FieldType.DATETIME)) {\n      throw new InvalidSchemaException(\n          \"Unsupported schema specified for Pubsub source in CREATE TABLE.\"\n              + \"CREATE TABLE for Pubsub topic must include at least 'event_timestamp' field of \"\n              + \"type 'TIMESTAMP'\");\n    }\n  }\n\n  private void validateDlq(@Nullable String deadLetterQueue) {\n    if (deadLetterQueue != null && deadLetterQueue.isEmpty()) {\n      throw new InvalidConfigurationException(\"Dead letter queue topic name is not specified\");\n    }\n  }\n\n  private void validateConfigurationSchema(Row configuration) {\n    if (!configuration.getSchema().equals(configurationSchema())) {\n      throw new InvalidConfigurationException(\n          \"Configuration schema provided does not match expected\");\n    }\n  }\n\n  /** An abstraction to create schema aware IOs. */\n  private static class PubsubSchemaIO implements SchemaIO, Serializable {\n    protected final Schema dataSchema;\n    protected final String location;\n    protected final boolean useFlatSchema;\n    protected final Config config;\n\n    private PubsubSchemaIO(String location, Row config, Schema dataSchema) {\n      this.dataSchema = dataSchema;\n      this.location = location;\n      this.useFlatSchema = !shouldUseNestedSchema(dataSchema);\n      this.config =\n          new AutoValueSchema().fromRowFunction(TypeDescriptor.of(Config.class)).apply(config);\n    }","sourceCodeStart":160,"sourceCodeEnd":196,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/pubsub/PubsubSchemaIOProvider.java#L160-L196","documentation":"PubsubSchemaIOProvider.validateConfigurationSchema() checks that the configuration Row passed to from() has exactly the schema returned by configurationSchema(). Any mismatch in field names, types, or order throws an InvalidConfigurationException.","triggerScenarios":"Calling PubsubSchemaIOProvider.from(configRow) with a hand-built or stale Row whose schema differs from the provider's expected configurationSchema() — e.g. after upgrading Beam where the config schema gained/renamed fields.","commonSituations":"Manually constructing the configuration Row instead of using the provider's schema/builders; cached config Rows built against an older Beam version; fields added or reordered in a newer SDK release.","solutions":["Build the configuration Row using the provider's own configurationSchema() (or the SchemaTransform providers' configuration Row builders) instead of hand-rolling a Row.","Verify the Row's schema equals PubsubSchemaIOProvider.configurationSchema() before calling from().","Upgrade/refresh code that hard-codes the config Row to match the SDK version's expected fields."],"exampleFix":"// before\nRow config = Row.withSchema(myAdHocSchema).addValues(topic).build();\n// after\nRow config = Row.withSchema(new PubsubSchemaIOProvider().configurationSchema()).addValues(topic, dlq, ...).build();","handlingStrategy":"validation","validationCode":"if (!configRow.getSchema().equals(new PubsubSchemaIOProvider().configurationSchema())) { throw new IllegalArgumentException(\"Configuration Row schema does not match provider's configurationSchema()\"); }","typeGuard":null,"tryCatchPattern":"try { ioProvider.from(configRow); } catch (InvalidConfigurationException e) { if (e.getMessage().contains(\"does not match expected\")) { /* rebuild Row using configurationSchema() */ } throw e; }","preventionTips":["Never hand-build the configuration Row; construct it from the provider's configurationSchema().","Re-check config Row construction after Beam upgrades, since the expected schema may change.","Add an equality check against configurationSchema() in pipeline setup tests."],"tags":["java","apache-beam","pubsub","schema","configuration"],"backgroundTag":"schema-validation-failed","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"}