{"record":{"id":"ac59804741d5152c","repo":"apache/seatunnel","slug":"illegal-argument-ac5980","errorCode":"ILLEGAL_ARGUMENT","errorMessage":"Inconsistent naming found at index ${i}: The collection name '${collectionName}' must match the schema table name '${fullName}'.","messagePattern":"Inconsistent naming found at index (.+?): The collection name '(.+?)' must match the schema table name '(.+?)'\\.","errorType":"error_code","errorClass":"MongodbConnectorException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-cdc/connector-cdc-mongodb/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/mongodb/MongodbIncrementalSourceFactory.java","lineNumber":118,"sourceCode":"                    new MongodbIncrementalSource<>(context.getOptions(), catalogTables);\n        };\n    }\n\n    private List<CatalogTable> updateAndValidateCatalogTableId(\n            List<CatalogTable> catalogTables, List<String> collections) {\n        for (int i = 0; i < catalogTables.size(); i++) {\n            CatalogTable catalogTable = catalogTables.get(i);\n            String collectionName = collections.get(i);\n            String fullName = catalogTable.getTablePath().getFullName();\n            if (fullName.equals(TablePath.DEFAULT.getFullName())) {\n                if (catalogTables.size() == 1) {\n                    TableIdentifier updatedIdentifier =\n                            TableIdentifier.of(\n                                    catalogTable.getCatalogName(), TablePath.of(collectionName));\n                    return Collections.singletonList(\n                            CatalogTable.of(updatedIdentifier, catalogTable));\n                } else if (!fullName.equals(collectionName)) {\n                    throw new MongodbConnectorException(\n                            ILLEGAL_ARGUMENT,\n                            String.format(\n                                    \"Inconsistent naming found at index %d: The collection name '%s' must match the schema table name '%s'.\",\n                                    i, collectionName, fullName));\n                }\n            }\n        }\n        return catalogTables;\n    }\n\n    private void validateCatalogTablesAndCollections(\n            List<CatalogTable> catalogTables, List<String> collections) {\n        if (catalogTables.size() != collections.size()) {\n            throw new MongodbConnectorException(\n                    ILLEGAL_ARGUMENT,\n                    \"The number of collections must be equal to the number of schema tables\");\n        }\n    }","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-cdc/connector-cdc-mongodb/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/mongodb/MongodbIncrementalSourceFactory.java#L100-L136","documentation":"MongodbIncrementalSourceFactory.updateAndValidateCatalogTableId reconciles user-provided collection names against catalog table metadata. When a catalog table's full name (db.collection) disagrees with the corresponding configured collection name and the identifier isn't just a bare collection name, it throws MongodbConnectorException(ILLEGAL_ARGUMENT) flagging inconsistent naming at the given index.","triggerScenarios":"The table-names/ collection config list and the catalog's resolved full names (database.collection) diverge in order or spelling — e.g. configuring a bare collection name in one place and db.collection in another, or two entries swapped.","commonSituations":"Configured 'mycoll' but catalog expects 'mydb.mycoll' with a different entry ordering; typo in one of the two lists; using database list + collection list that don't align index-wise.","solutions":["Make the configured collection names exactly match the catalog's database.collection full names","Verify order of entries matches between config and catalog resolution","Use the full 'database.collection' format in table-names to avoid ambiguity","Fix the typo causing the mismatch reported at index i"],"exampleFix":"// before\ntable-names = [\"mycoll\", \"otherdb.othercoll\"]\n// after\ntable-names = [\"mydb.mycoll\", \"otherdb.othercoll\"]","handlingStrategy":"validation","validationCode":"// Ensure collection entries match catalog full names before createSource\nList<String> configured = ...; List<String> fullNames = ...;\nfor (int i = 0; i < configured.size(); i++) {\n  if (!fullNames.contains(configured.get(i)) && !configured.get(i).equals(fullNames.get(i)))\n    throw new IllegalArgumentException(\"Mismatch at \" + i + \": \" + configured.get(i) + \" vs \" + fullNames.get(i));\n}","typeGuard":null,"tryCatchPattern":"try { factory.createSource(context); } catch (MongodbConnectorException e) { if (e.getSeaTunnelErrorCode() == MongodbConnectorErrorCode.ILLEGAL_ARGUMENT && e.getMessage().contains(\"Inconsistent naming\")) { /* align table-names with catalog db.collection names */ } throw e; }","preventionTips":["Use full database.collection names consistently in all configs","Keep entry order aligned with catalog resolution","Avoid typos by generating table-names from the same source as the catalog"],"tags":["mongodb","cdc","illegal-argument","naming"],"backgroundTag":"invalid-argument-value","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"}