{"record":{"id":"857f464fd78929ae","repo":"apache/seatunnel","slug":"table-tableid-is-not-enabled-for-capture","errorCode":null,"errorMessage":"Table ${tableId} is not enabled for capture","messagePattern":"Table (.+?) is not enabled for capture","errorType":"exception","errorClass":"SeaTunnelException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-cdc/connector-cdc-sqlserver/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/sqlserver/source/SqlServerDialect.java","lineNumber":119,"sourceCode":"            throw new SeaTunnelException(\"Error to discover tables: \" + e.getMessage(), e);\n        }\n    }\n\n    @Override\n    public void checkAllTablesEnabledCapture(JdbcConnection jdbcConnection, List<TableId> tableIds)\n            throws SQLException {\n        Map<String, List<TableId>> databases =\n                tableIds.stream()\n                        .collect(Collectors.groupingBy(TableId::catalog, Collectors.toList()));\n        for (String database : databases.keySet()) {\n            Set<TableId> tables =\n                    ((SqlServerConnection) jdbcConnection)\n                            .getChangeTables(database).stream()\n                                    .map(SqlServerChangeTable::getSourceTableId)\n                                    .collect(Collectors.toSet());\n            for (TableId tableId : databases.get(database)) {\n                if (!tables.contains(tableId)) {\n                    throw new SeaTunnelException(\n                            \"Table \" + tableId + \" is not enabled for capture\");\n                }\n            }\n        }\n    }\n\n    @Override\n    public TableChanges.TableChange queryTableSchema(JdbcConnection jdbc, TableId tableId) {\n        if (sqlServerSchema == null) {\n            sqlServerSchema = new SqlServerSchema(sourceConfig.getDbzConnectorConfig(), tableMap);\n        }\n        return sqlServerSchema.getTableSchema(jdbc, tableId);\n    }\n\n    @Override\n    public SqlServerSourceFetchTaskContext createFetchTaskContext(\n            SourceSplitBase sourceSplitBase, JdbcSourceConfig taskSourceConfig) {\n","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-cdc/connector-cdc-sqlserver/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/sqlserver/source/SqlServerDialect.java#L101-L137","documentation":"Thrown by SqlServerDialect.checkAllTablesEnabledCapture() when a table selected by the config's table filters is not present in sys.cdc_change_tables, i.e. SQL Server CDC capture is not enabled for it. The connector cannot stream changes for such a table.","triggerScenarios":"discoverDataCollections or createFetchTask validates tableIds against getChangeTables(database) and a configured tableId is missing from the CDC-enabled set — usually after adding a table to config without running sys.sp_cdc_enable_table, or after CDC was disabled.","commonSituations":"Admin disabled CDC on a table (or the whole database) while the job config still lists it; table renamed so the TableId no longer matches; new environment/restore where CDC scripts were never applied.","solutions":["Enable CDC on the table: EXEC sys.sp_cdc_enable_table @source_schema=..., @source_name=..., @role_name=NULL;","Confirm CDC is enabled on the database: SELECT is_cdc_enabled FROM sys.databases WHERE name='...';","Remove the non-CDC table from the connector's table list / table-names regex","Check for schema or case mismatches between the config table name and the actual table","Re-apply CDC setup scripts if the database was restored from a backup without them"],"exampleFix":"// before\n-- table not captured\n-- job config includes dbo.orders but CDC off\n-- after\nUSE MyDb;\nEXEC sys.sp_cdc_enable_table\n  @source_schema = N'dbo',\n  @source_name  = N'orders',\n  @role_name    = NULL;","handlingStrategy":"validation","validationCode":"// verify every configured table is CDC-enabled before submitting the job\nfor (String table : configuredTables) {\n    String[] parts = table.split(\"\\\\.\");\n    ResultSet rs = conn.createStatement().executeQuery(\n        \"SELECT 1 FROM sys.cdc_change_tables ct \" +\n        \"JOIN sys.tables t ON t.object_id = ct.object_id \" +\n        \"JOIN sys.schemas s ON s.schema_id = t.schema_id \" +\n        \"WHERE s.name = '\" + parts[0] + \"' AND t.name = '\" + parts[1] + \"'\");\n    if (!rs.next()) throw new IllegalStateException(\"CDC not enabled: \" + table);\n}","typeGuard":null,"tryCatchPattern":"try {\n    dialect.discoverDataCollections(config);\n} catch (SeaTunnelException e) {\n    if (e.getMessage().contains(\"is not enabled for capture\")) {\n        LOG.error(\"Run sys.sp_cdc_enable_table for the offending table, or remove it from config\");\n    }\n    throw e;\n}","preventionTips":["Always run sp_cdc_enable_table for each table in the table-names config after deploying to a new environment","Check is_cdc_enabled on the database and sys.cdc_change_tables per table before job start","Exclude non-CDC tables from the table filter or enable them","Watch for renames/schema changes that break TableId matching"],"tags":["sqlserver","cdc","configuration","feature-not-enabled"],"backgroundTag":"feature-not-enabled","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"}