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

Failed to read schema for table %s

Error message

Failed to read schema for table %s 

What it means

Db2Schema.readTableSchema wraps failures while building the Debezium table schema for the configured DB2 tables (connector config issues, table filtering, schema loading errors) into this exception carrying the table id, propagated to getTableSchema.

Source

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

                    tables,
                    null,
                    tableId.schema(),
                    connectorConfig.getTableFilters().dataCollectionFilter(),
                    null,
                    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. Check the wrapped SQLException cause for the exact DB2 error
  2. Grant the CDC user access to the required system catalog views (SYSCAT.*)
  3. Confirm the table exists and the identifier matches (schema/table name and case)
  4. Verify DB2 connectivity and retry the job
Defensive patterns

Strategy: try-catch

Validate before calling

-- verify catalog access before job
SELECT * FROM SYSCAT.TABLES WHERE TABSCHEMA='X' AND TABNAME='Y';

Try / catch

try { runPipeline(); } catch (SeaTunnelException e) { if (e.getMessage().startsWith("Failed to read schema")) { checkPrivilegesAndConnection(); } }

Prevention

When it happens

Trigger: getTableSchema -> readTableSchema executes the schema query and catches SQLException — bad connection, missing catalog privileges, or invalid table identifier.

Common situations: CDC user lacking permissions on system catalog views; connection dropped; table renamed/dropped between split planning and schema read; quoting/case mismatch in table identifier.

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/9cb28fee3edce753. Report an issue: GitHub.