{"record":{"id":"88659a06865aa08f","repo":"apache/seatunnel","slug":"cannot-find-table-schema-for-table-tableid-tri","errorCode":null,"errorMessage":"Cannot find table schema for table ${tableId}. Tried table id: ${tableIdWithoutCatalog}.","messagePattern":"Cannot find table schema for table (.+?)\\. Tried table id: (.+?)\\.","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":185,"sourceCode":"                dispatcher.getSnapshotChangeEventReceiver();\n        log.debug(\"Snapshotting table {}\", tableId);\n        createDataEventsForTable(snapshotContext, snapshotReceiver, resolveTable(tableId));\n        snapshotReceiver.completeSnapshot();\n    }\n\n    private Table resolveTable(TableId tableId) {\n        TableId tableIdWithoutCatalog = new TableId(null, tableId.schema(), tableId.table());\n        Table table = databaseSchema.tableFor(tableIdWithoutCatalog);\n        if (table != null) {\n            return table;\n        }\n\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. */","sourceCodeStart":167,"sourceCodeEnd":203,"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#L167-L203","documentation":"PostgresSnapshotSplitReadTask.resolveTable looks up the table schema in the Debezium/SeaTunnel table catalog. It first falls back to the connector's configured database name when the TableId has no catalog; if the catalog is still empty it throws IllegalStateException 'Cannot find table schema for table <tableId>. Tried table id: <tableIdWithoutCatalog>.', because snapshot events cannot be converted without schema metadata.","triggerScenarios":"createDataEvents calls resolveTable for a split's TableId whose catalog part is null/empty AND connectorConfig.databaseName() is also null/empty, or the table is simply absent from the catalog after both attempts.","commonSituations":"`database-name` not set in source config while the table id lacks a catalog; table dropped or renamed between split enumeration and snapshot execution; case-sensitivity mismatches (quoted identifiers) causing catalog lookup misses; capturing tables across databases with wrong database-name.","solutions":["Set `database-name` explicitly in the PostgreSQL CDC source options.","Verify the table still exists (`\\d+ <schema>.<table>`) and matches the configured table names exactly, including case.","Check the `table-names` config for typos or wrong schema qualification.","Re-enumerate splits / restart the job so the catalog is rebuilt after DDL changes."],"exampleFix":"// before\nPostgresIncrementalSource.builder()\n    .tableNames(\"public.orders\")\n    // database-name missing\n// after\nPostgresIncrementalSource.builder()\n    .tableNames(\"public.orders\")\n    .database(\"mydb\")\n    .build();","handlingStrategy":"validation","validationCode":"// Verify each configured table resolves before submitting\nfor (String t : tableNames) {\n    // t must include schema, e.g. public.orders; database-name must be set\n}","typeGuard":null,"tryCatchPattern":"try {\n    job.execute();\n} catch (IllegalStateException e) {\n    if (e.getMessage().startsWith(\"Cannot find table schema\")) {\n        // fix database-name/table-names config and resubmit\n    }\n}","preventionTips":["Always set database-name in PostgreSQL CDC source options","Use fully-qualified table names (schema.table) with correct case","Check that tables exist and are unchanged between split enumeration and execution","Avoid cross-database captures unless explicitly configured"],"tags":["postgresql","cdc","snapshot","table-schema","config"],"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-23T08:17:48.524Z"}