{"record":{"id":"8b9aa0d574d822a4","repo":"apache/seatunnel","slug":"vitess-cdc-accepts-either-table-names-or-table-pat","errorCode":null,"errorMessage":"Vitess CDC accepts either table-names or table-pattern, but not both.","messagePattern":"Vitess CDC accepts either table-names or table-pattern, but not both\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-cdc/connector-cdc-vitess/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/vitess/source/VitessSourceFactory.java","lineNumber":179,"sourceCode":"\n    @SuppressWarnings(\"unchecked\")\n    private void validateSchemaDefinition(Map<String, Object> config, String optionName) {\n        Object schemaValue = config.get(ConnectorCommonOptions.SCHEMA.key());\n        if (!(schemaValue instanceof Map)) {\n            throw new IllegalArgumentException(\n                    String.format(\n                            \"Vitess CDC requires explicit schema metadata. '%s' must contain a schema block.\",\n                            optionName));\n        }\n        validateRootSchemaDefinition((Map<String, Object>) schemaValue, optionName + \".schema\");\n    }\n\n    private void validateSelectionOptions(TableSourceFactoryContext context) {\n        if (context.getOptions().getOptional(ConnectorCommonOptions.TABLE_NAMES).isPresent()\n                && context.getOptions()\n                        .getOptional(ConnectorCommonOptions.TABLE_PATTERN)\n                        .isPresent()) {\n            throw new IllegalArgumentException(\n                    \"Vitess CDC accepts either table-names or table-pattern, but not both.\");\n        }\n    }\n\n    private List<CatalogTable> filterDeclaredTables(\n            TableSourceFactoryContext context, List<CatalogTable> declaredTables) {\n        Optional<List<String>> explicitTableNames =\n                context.getOptions().getOptional(ConnectorCommonOptions.TABLE_NAMES);\n        if (explicitTableNames.isPresent()) {\n            List<CatalogTable> selectedTables = new ArrayList<>(explicitTableNames.get().size());\n            for (String tableName : explicitTableNames.get()) {\n                CatalogTable matchedTable =\n                        declaredTables.stream()\n                                .filter(table -> table.getTablePath().toString().equals(tableName))\n                                .findFirst()\n                                .orElseThrow(\n                                        () ->\n                                                new IllegalArgumentException(","sourceCodeStart":161,"sourceCodeEnd":197,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-cdc/connector-cdc-vitess/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/vitess/source/VitessSourceFactory.java#L161-L197","documentation":"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.","triggerScenarios":"Calling VitessSourceFactory.resolveCatalogTables on a context whose options contain both ConnectorCommonOptions.TABLE_NAMES and ConnectorCommonOptions.TABLE_PATTERN.","commonSituations":"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.","solutions":["Remove table-names and keep only table-pattern for regex selection","Remove table-pattern and keep only table-names for explicit selection"],"exampleFix":"// before\ntable-names = [\"commerce.orders\"]\ntable-pattern = \"commerce.order.*\"\n// after\ntable-names = [\"commerce.orders\"]","handlingStrategy":"validation","validationCode":"boolean hasNames = options.containsKey(TABLE_NAMES);\nboolean hasPattern = options.containsKey(TABLE_PATTERN);\nif (hasNames && hasPattern) {\n    throw new IllegalArgumentException(\"Use table-names or table-pattern, not both\");\n}","typeGuard":null,"tryCatchPattern":"try { factory.resolveCatalogTables(context); } catch (IllegalArgumentException e) { /* drop one selection option */ }","preventionTips":["Pick one selection strategy per source config","Check merged/templated configs for both keys","Document the mutual exclusion in team config conventions"],"tags":["cdc","vitess","conflicting-options"],"backgroundTag":"mutually-exclusive-options","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"}