{"record":{"id":"b27bdc49d685f687","repo":"apache/seatunnel","slug":"cannot-find-table-schema-for-table-tableid-tri-b27bdc","errorCode":null,"errorMessage":"Cannot find table schema for table ${tableId}. Tried table ids: ${tableIdWithoutCatalog} and ${tableIdWithCatalog}.","messagePattern":"Cannot find table schema for table (.+?)\\. Tried table ids: (.+?) and (.+?)\\.","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-cdc/connector-cdc-postgres/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/postgres/source/reader/snapshot/PostgresSnapshotSplitReadTask.java","lineNumber":197,"sourceCode":"\n        String catalog = tableId.catalog();\n        if (catalog == null || catalog.isEmpty()) {\n            catalog = connectorConfig.databaseName();\n        }\n        if (catalog == null || catalog.isEmpty()) {\n            throw new IllegalStateException(\n                    String.format(\n                            \"Cannot find table schema for table %s. Tried table id: %s.\",\n                            tableId, tableIdWithoutCatalog));\n        }\n\n        TableId tableIdWithCatalog = new TableId(catalog, tableId.schema(), tableId.table());\n        table = databaseSchema.tableFor(tableIdWithCatalog);\n        if (table != null) {\n            return table;\n        }\n\n        throw new IllegalStateException(\n                String.format(\n                        \"Cannot find table schema for table %s. Tried table ids: %s and %s.\",\n                        tableId, tableIdWithoutCatalog, tableIdWithCatalog));\n    }\n\n    /** Dispatches the data change events for the records of a single table. */\n    private void createDataEventsForTable(\n            PostgresSnapshotContext snapshotContext,\n            EventDispatcher.SnapshotReceiver snapshotReceiver,\n            Table table)\n            throws InterruptedException {\n\n        long exportStart = clock.currentTimeInMillis();\n        log.info(\"Exporting data from split '{}' of table {}\", snapshotSplit.splitId(), table.id());\n\n        final String selectSql =\n                PostgresUtils.buildSplitScanQuery(\n                        table,","sourceCodeStart":179,"sourceCodeEnd":215,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-cdc/connector-cdc-postgres/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/postgres/source/reader/snapshot/PostgresSnapshotSplitReadTask.java#L179-L215","documentation":"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.","triggerScenarios":"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).","commonSituations":"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).","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"],"exampleFix":"// before\ntable-names = [\"public\", \"orders\"]   // table actually named \"Orders\"\n// after\ntable-names = [\"public\", \"Orders\"]   // match exact Postgres case","handlingStrategy":"validation","validationCode":"// before running the job, verify the table id resolves\nString sql = \"SELECT 1 FROM information_schema.tables WHERE table_schema=? AND table_name=?\";\ntry (PreparedStatement ps = conn.prepareStatement(sql)) {\n    ps.setString(1, schema); ps.setString(2, table);\n    try (ResultSet rs = ps.executeQuery()) { if (!rs.next()) throw new IllegalStateException(\"table missing: \" + schema + \".\" + table); }\n}","typeGuard":null,"tryCatchPattern":"try { snapshotReader.createDataEvents(split, records); } catch (IllegalStateException e) {\n    if (e.getMessage().contains(\"Cannot find table schema\")) { log.error(\"Schema missing for split table; re-enumerate and restart snapshot\"); }\n    throw e;\n}","preventionTips":["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"],"tags":["postgres","cdc","schema","snapshot"],"backgroundTag":"entity-not-found","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}