apache/seatunnel · error · IllegalArgumentException

Vitess CDC accepts either table-names or table-pattern, but…

Error message

Vitess CDC accepts either table-names or table-pattern, but not both.

What it means

Validation in VitessSourceFactory.validateSelectionOptions: table-names and table-pattern are mutually exclusive ways to select tables for CDC; specifying both is ambiguous, so factory resolution fails with IllegalArgumentException.

Solutions

  1. Remove table-names and keep only table-pattern for regex selection
  2. Remove table-pattern and keep only table-names for explicit selection

Example fix

// before
table-names = ["commerce.orders"]
table-pattern = "commerce.order.*"
// after
table-names = ["commerce.orders"]
Defensive patterns

Strategy: validation

Validate before calling

boolean hasNames = options.containsKey(TABLE_NAMES);
boolean hasPattern = options.containsKey(TABLE_PATTERN);
if (hasNames && hasPattern) {
    throw new IllegalArgumentException("Use table-names or table-pattern, not both");
}

Try / catch

try { factory.resolveCatalogTables(context); } catch (IllegalArgumentException e) { /* drop one selection option */ }

Prevention

When it happens

Trigger: Calling VitessSourceFactory.resolveCatalogTables on a context whose options contain both ConnectorCommonOptions.TABLE_NAMES and ConnectorCommonOptions.TABLE_PATTERN.

Common situations: Merging two config files that each set a different selection option; adding table-pattern while forgetting to remove table-names; a templating engine emitting both keys.

Related errors


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

Appendix: source

Thrown at seatunnel-connectors-v2/connector-cdc/connector-cdc-vitess/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/vitess/source/VitessSourceFactory.java:179

    @SuppressWarnings("unchecked")
    private void validateSchemaDefinition(Map<String, Object> config, String optionName) {
        Object schemaValue = config.get(ConnectorCommonOptions.SCHEMA.key());
        if (!(schemaValue instanceof Map)) {
            throw new IllegalArgumentException(
                    String.format(
                            "Vitess CDC requires explicit schema metadata. '%s' must contain a schema block.",
                            optionName));
        }
        validateRootSchemaDefinition((Map<String, Object>) schemaValue, optionName + ".schema");
    }

    private void validateSelectionOptions(TableSourceFactoryContext context) {
        if (context.getOptions().getOptional(ConnectorCommonOptions.TABLE_NAMES).isPresent()
                && context.getOptions()
                        .getOptional(ConnectorCommonOptions.TABLE_PATTERN)
                        .isPresent()) {
            throw new IllegalArgumentException(
                    "Vitess CDC accepts either table-names or table-pattern, but not both.");
        }
    }

    private List<CatalogTable> filterDeclaredTables(
            TableSourceFactoryContext context, List<CatalogTable> declaredTables) {
        Optional<List<String>> explicitTableNames =
                context.getOptions().getOptional(ConnectorCommonOptions.TABLE_NAMES);
        if (explicitTableNames.isPresent()) {
            List<CatalogTable> selectedTables = new ArrayList<>(explicitTableNames.get().size());
            for (String tableName : explicitTableNames.get()) {
                CatalogTable matchedTable =
                        declaredTables.stream()
                                .filter(table -> table.getTablePath().toString().equals(tableName))
                                .findFirst()
                                .orElseThrow(
                                        () ->
                                                new IllegalArgumentException(

View on GitHub (pinned to cf67b549a7)