apache/seatunnel · error · IllegalStateException
Cannot find table schema for table ${tableId}. Tried table i
Error message
Cannot find table schema for table ${tableId}. Tried table ids: ${tableIdWithoutCatalog} and ${tableIdWithCatalog}. What it means
PostgresSnapshotReadTask.resolveTableSchema looks up the table's schema in the Debezium DatabaseSchema first by the user-supplied TableId (schema.table) and then with the connector catalog prepended (catalog.schema.table). If neither lookup returns a table, it throws this IllegalStateException because the snapshot reader cannot produce column metadata for the split.
Source
Thrown at seatunnel-connectors-v2/connector-cdc/connector-cdc-postgres/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/postgres/source/reader/snapshot/PostgresSnapshotSplitReadTask.java:197
String catalog = tableId.catalog();
if (catalog == null || catalog.isEmpty()) {
catalog = connectorConfig.databaseName();
}
if (catalog == null || catalog.isEmpty()) {
throw new IllegalStateException(
String.format(
"Cannot find table schema for table %s. Tried table id: %s.",
tableId, tableIdWithoutCatalog));
}
TableId tableIdWithCatalog = new TableId(catalog, tableId.schema(), tableId.table());
table = databaseSchema.tableFor(tableIdWithCatalog);
if (table != null) {
return table;
}
throw new IllegalStateException(
String.format(
"Cannot find table schema for table %s. Tried table ids: %s and %s.",
tableId, tableIdWithoutCatalog, tableIdWithCatalog));
}
/** Dispatches the data change events for the records of a single table. */
private void createDataEventsForTable(
PostgresSnapshotContext snapshotContext,
EventDispatcher.SnapshotReceiver snapshotReceiver,
Table table)
throws InterruptedException {
long exportStart = clock.currentTimeInMillis();
log.info("Exporting data from split '{}' of table {}", snapshotSplit.splitId(), table.id());
final String selectSql =
PostgresUtils.buildSplitScanQuery(
table,View on GitHub (pinned to cf67b549a7)
Solutions
- Verify the table exists and check exact spelling/case of database, schema and table in the config against \dt in psql
- Confirm the table is matched by the table-names/database-name config and the connector's table filter so its schema is loaded into the DatabaseSchema at startup
- Re-run the job (restart snapshot) after recreating/renaming the table so the schema cache is rebuilt
- Check for concurrent DDL (DROP/RENAME/ALTER) during the snapshot and schedule snapshots outside DDL windows
Example fix
// before table-names = ["public", "orders"] // table actually named "Orders" // after table-names = ["public", "Orders"] // match exact Postgres case
Defensive patterns
Strategy: validation
Validate before calling
// before running the job, verify the table id resolves
String sql = "SELECT 1 FROM information_schema.tables WHERE table_schema=? AND table_name=?";
try (PreparedStatement ps = conn.prepareStatement(sql)) {
ps.setString(1, schema); ps.setString(2, table);
try (ResultSet rs = ps.executeQuery()) { if (!rs.next()) throw new IllegalStateException("table missing: " + schema + "." + table); }
} Try / catch
try { snapshotReader.createDataEvents(split, records); } catch (IllegalStateException e) {
if (e.getMessage().contains("Cannot find table schema")) { log.error("Schema missing for split table; re-enumerate and restart snapshot"); }
throw e;
} Prevention
- Match table-name case exactly between SeaTunnel config and Postgres
- Avoid DDL (drop/rename) while a snapshot is in progress
- Ensure all configured tables are covered by the connector's table filter so schemas load at startup
When it happens
Trigger: createDataEvents dispatches a snapshot split for a TableId that is absent from the DatabaseSchema built at task startup — e.g. the table was dropped or renamed between split enumeration and snapshot read, the tableId case does not match the actual Postgres schema/table name, or tableIdWithoutCatalog/tableIdWithCatalog normalization fails (catalog name differs from what the schema was built with).
Common situations: Case-sensitive table names quoted differently in the seatunnel config than in Postgres; dropping/truncating the table while a snapshot is running; running a job whose config lists a table not included in the CDC table filter so the schema was never loaded; a catalog configuration mismatch (database name changed).
Understand the failure class
Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.
Related errors
- Snapshotting of table ${table.id()} failed
- Can't obtain schema for table ${tableId}
- Snapshot was interrupted before completion
- Unsupported alter table event:
- Unsupported alter table event:
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/b27bdc49d685f687.
Report an issue: GitHub.