{"record":{"id":"1ce8a4b7a62c2437","repo":"apache/beam","slug":"unable-to-retrieve-schema-for-table-s-found-only-tables-s","errorCode":null,"errorMessage":"Unable to retrieve schema for table %s. Found only tables: [%s]","messagePattern":"Unable to retrieve schema for table (.+?)\\. Found only tables: \\[(.+?)\\]","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/spanner/changestreams/SpannerChangestreamsReadSchemaTransformProvider.java","lineNumber":353,"sourceCode":"        .setCoder(StringUtf8Coder.of());\n    miniPipeline.run().waitUntilFinish();\n    // Clean up the static map from the object.\n    SpannerSchema finalSchemaObj = TABLE_SCHEMAS.remove(config.getTable());\n    if (finalSchemaObj == null) {\n      throw new RuntimeException(\n          String.format(\"Could not get schema for configuration %s\", config));\n    }\n    return spannerSchemaToBeamSchema(finalSchemaObj, config.getTable());\n  }\n\n  private static Schema spannerSchemaToBeamSchema(\n      SpannerSchema spannerSchema, final String tableName) {\n    OptionalInt optionalIdx =\n        IntStream.range(0, spannerSchema.getTables().size())\n            .filter(idx -> spannerSchema.getTables().get(idx).equalsIgnoreCase(tableName))\n            .findAny();\n    if (!optionalIdx.isPresent()) {\n      throw new IllegalArgumentException(\n          String.format(\n              \"Unable to retrieve schema for table %s. Found only tables: [%s]\",\n              tableName, String.join(\", \", spannerSchema.getTables())));\n    }\n    Schema.Builder schemaBuilder = Schema.builder();\n\n    String spannerTableName = spannerSchema.getTables().get(optionalIdx.getAsInt());\n\n    for (SpannerSchema.Column col : spannerSchema.getColumns(spannerTableName)) {\n      schemaBuilder =\n          schemaBuilder.addNullableField(col.getName(), spannerTypeToBeamType(col.getType()));\n    }\n\n    schemaBuilder =\n        schemaBuilder.setOptions(\n            Schema.Options.builder()\n                .setOption(\n                    \"primaryKeyColumns\",","sourceCodeStart":335,"sourceCodeEnd":371,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/spanner/changestreams/SpannerChangestreamsReadSchemaTransformProvider.java#L335-L371","documentation":"Thrown by spannerSchemaToBeamSchema when the fetched SpannerSchema does not contain any table whose name equals (case-insensitively) the requested tableName. The provider cannot map a Beam Schema without the table's row definition, so it fails fast with the list of tables it does know.","triggerScenarios":"Calling getTableSchema with a table name that is absent from the SpannerSchema captured by the change stream pipeline; requesting a table the change stream does not cover; a case/whitespace mismatch between config table name and the actual table name.","commonSituations":"Typo in table name in the Spanner change stream configuration; change stream created over a different table than configured; renamed/dropped table while the pipeline config still references the old name.","solutions":["Compare the tableName in the error message against the 'Found only tables' list and fix the configuration to use an exact (case-insensitive) match.","Verify the change stream is created on (or watches) the table you configured to read.","Re-check the database configuration — connecting to the wrong Spanner database yields a schema lacking your table.","If the table was renamed, update the pipeline configuration to the new table name."],"exampleFix":"// before\n.setTable(\"orders\")   // found tables: [Order]\n// after\n.setTable(\"Order\")     // or correct the actual table name in Spanner","handlingStrategy":"validation","validationCode":"boolean exists = spannerSchema.getTables().stream()\n    .anyMatch(t -> t.equalsIgnoreCase(tableName));\nif (!exists) throw new IllegalArgumentException(\"Unknown table: \" + tableName);","typeGuard":null,"tryCatchPattern":"try { schema = provider.expand(config); } catch (IllegalArgumentException e) { /* table list is in the message; reconfigure and retry */ }","preventionTips":["Copy table names from the 'Found only tables' list verbatim into your configuration.","Confirm the change stream is created over the exact table you read.","Update configs when tables are renamed or dropped."],"tags":["spanner","table-not-found","schema","java"],"backgroundTag":"entity-not-found","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}