apache/seatunnel · error · SeaTunnelException

Table ${tableId} is not enabled for capture

Error message

Table ${tableId} is not enabled for capture

What it means

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.

Source

Thrown at seatunnel-connectors-v2/connector-cdc/connector-cdc-sqlserver/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/sqlserver/source/SqlServerDialect.java:119

            throw new SeaTunnelException("Error to discover tables: " + e.getMessage(), e);
        }
    }

    @Override
    public void checkAllTablesEnabledCapture(JdbcConnection jdbcConnection, List<TableId> tableIds)
            throws SQLException {
        Map<String, List<TableId>> databases =
                tableIds.stream()
                        .collect(Collectors.groupingBy(TableId::catalog, Collectors.toList()));
        for (String database : databases.keySet()) {
            Set<TableId> tables =
                    ((SqlServerConnection) jdbcConnection)
                            .getChangeTables(database).stream()
                                    .map(SqlServerChangeTable::getSourceTableId)
                                    .collect(Collectors.toSet());
            for (TableId tableId : databases.get(database)) {
                if (!tables.contains(tableId)) {
                    throw new SeaTunnelException(
                            "Table " + tableId + " is not enabled for capture");
                }
            }
        }
    }

    @Override
    public TableChanges.TableChange queryTableSchema(JdbcConnection jdbc, TableId tableId) {
        if (sqlServerSchema == null) {
            sqlServerSchema = new SqlServerSchema(sourceConfig.getDbzConnectorConfig(), tableMap);
        }
        return sqlServerSchema.getTableSchema(jdbc, tableId);
    }

    @Override
    public SqlServerSourceFetchTaskContext createFetchTaskContext(
            SourceSplitBase sourceSplitBase, JdbcSourceConfig taskSourceConfig) {

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Enable CDC on the table: EXEC sys.sp_cdc_enable_table @source_schema=..., @source_name=..., @role_name=NULL;
  2. Confirm CDC is enabled on the database: SELECT is_cdc_enabled FROM sys.databases WHERE name='...';
  3. Remove the non-CDC table from the connector's table list / table-names regex
  4. Check for schema or case mismatches between the config table name and the actual table
  5. Re-apply CDC setup scripts if the database was restored from a backup without them

Example fix

// before
-- table not captured
-- job config includes dbo.orders but CDC off
-- after
USE MyDb;
EXEC sys.sp_cdc_enable_table
  @source_schema = N'dbo',
  @source_name  = N'orders',
  @role_name    = NULL;
Defensive patterns

Strategy: validation

Validate before calling

// verify every configured table is CDC-enabled before submitting the job
for (String table : configuredTables) {
    String[] parts = table.split("\\.");
    ResultSet rs = conn.createStatement().executeQuery(
        "SELECT 1 FROM sys.cdc_change_tables ct " +
        "JOIN sys.tables t ON t.object_id = ct.object_id " +
        "JOIN sys.schemas s ON s.schema_id = t.schema_id " +
        "WHERE s.name = '" + parts[0] + "' AND t.name = '" + parts[1] + "'");
    if (!rs.next()) throw new IllegalStateException("CDC not enabled: " + table);
}

Try / catch

try {
    dialect.discoverDataCollections(config);
} catch (SeaTunnelException e) {
    if (e.getMessage().contains("is not enabled for capture")) {
        LOG.error("Run sys.sp_cdc_enable_table for the offending table, or remove it from config");
    }
    throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/857f464fd78929ae. Report an issue: GitHub.