apache/seatunnel · error · org.apache.seatunnel.api.table.type.SeaTunnelException

Can't obtain schema for table %s

Error message

Can't obtain schema for table %s 

What it means

Db2Schema.readTableSchema throws this when no schema entry could be produced for the requested table — after building the Debezium Db2DatabaseSchema, the table was absent or filtered out, so no TableChange exists for it.

Source

Thrown at seatunnel-connectors-v2/connector-cdc/connector-cdc-db2/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/db2/utils/Db2Schema.java:87

                    false);
            for (TableId id : tables.tableIds()) {
                if (tableMap.containsKey(id)) {
                    Table table =
                            CatalogTableUtils.mergeCatalogTableConfig(
                                    tables.forTable(id), tableMap.get(id));
                    TableChanges.TableChange tableChange =
                            new TableChanges.TableChange(
                                    TableChanges.TableChangeType.CREATE, table);
                    schemasByTableId.put(id, tableChange);
                }
            }
        } catch (SQLException e) {
            throw new SeaTunnelException(
                    String.format("Failed to read schema for table %s ", tableId), e);
        }

        if (!schemasByTableId.containsKey(tableId)) {
            throw new SeaTunnelException(
                    String.format("Can't obtain schema for table %s ", tableId));
        }

        return schemasByTableId.get(tableId);
    }
}

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Verify the exact schema and table names as stored in DB2 (usually uppercase) and fix the table list in the source config
  2. Confirm the JDBC URL points to the database containing the table
  3. Re-check that the table still exists (it may have been dropped/renamed)
  4. Retry after correcting identifiers; the schema cache is rebuilt per read

Example fix

// before
table-names = ["mydb.MyTable"]
// after
table-names = ["MYDB.MYTABLE"]
Defensive patterns

Strategy: validation

Validate before calling

-- confirm exact stored identifier casing
SELECT TABSCHEMA, TABNAME FROM SYSCAT.TABLES WHERE UPPER(TABNAME)='MYTABLE';

Try / catch

try { runPipeline(); } catch (SeaTunnelException e) { if (e.getMessage().startsWith("Can't obtain schema")) { fixTableIdentifierCasing(); } }

Prevention

When it happens

Trigger: The metadata query returned rows but none matched the requested table id — e.g. identifier case/quoting mismatch, table dropped between query planning and schema read, or querying a table in a database/schema the connection does not target.

Common situations: Table name casing mismatch (DB2 stores uppercase identifiers); wrong database in JDBC URL; table renamed concurrently; filtering out the table in config while it is still referenced by a split.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/575ebaa5de6a10f7. Report an issue: GitHub.