{"record":{"id":"68e9a67793748bae","repo":"apache/seatunnel","slug":"table-s-field-s-duplicate","errorCode":null,"errorMessage":"Table %s field %s duplicate","messagePattern":"Table (.+?) field (.+?) duplicate","errorType":"validation","errorClass":"SeaTunnelException","httpStatus":null,"severity":"error","filePath":"seatunnel-api/src/main/java/org/apache/seatunnel/api/table/factory/TableFactoryContext.java","lineNumber":53,"sourceCode":"    private final ClassLoader classLoader;\n\n    public TableFactoryContext(ReadonlyConfig options, ClassLoader classLoader) {\n        this.options = options;\n        this.classLoader = classLoader;\n    }\n\n    protected static void checkCatalogTableIllegal(List<CatalogTable> catalogTables) {\n        for (CatalogTable catalogTable : catalogTables) {\n            List<String> alreadyChecked = new ArrayList<>();\n            for (String fieldName : catalogTable.getTableSchema().getFieldNames()) {\n                if (StringUtils.isBlank(fieldName)) {\n                    throw new SeaTunnelException(\n                            String.format(\n                                    \"Table %s field name cannot be empty\",\n                                    catalogTable.getTablePath().getFullName()));\n                }\n                if (alreadyChecked.contains(fieldName)) {\n                    throw new SeaTunnelException(\n                            String.format(\n                                    \"Table %s field %s duplicate\",\n                                    catalogTable.getTablePath().getFullName(), fieldName));\n                }\n                alreadyChecked.add(fieldName);\n            }\n        }\n    }\n}\n","sourceCodeStart":35,"sourceCodeEnd":63,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/factory/TableFactoryContext.java#L35-L63","documentation":"Thrown by TableFactoryContext.checkCatalogTableIllegal when the same field name appears more than once in a CatalogTable's schema. Duplicate column names are ambiguous for row-type resolution and downstream column mapping, so the factory context rejects the table before plugin creation.","triggerScenarios":"Calling TableFactoryContext (via createAndPrepareSource/Sink/Transform) with a CatalogTable whose TableSchema.getFieldNames() contains a repeated name — e.g. a schema block declaring 'name' twice, or a catalog merging multiple upstream column definitions under the same key.","commonSituations":"Copy-paste errors in hand-written schema blocks; CDC pipelines where a renamed column collides with an existing one; connector catalog code that appends columns without de-duplicating; multi-table configs where a shared schema fragment is merged twice.","solutions":["Remove or rename the duplicate field in the schema so all names are unique.","Use a Transform (e.g. Replace/SQL) to rename one of the colliding upstream columns before the sink.","If building CatalogTable in code, de-duplicate field names when constructing TableSchema.","Check which connector/catalog produced the duplicated column and fix its column derivation."],"exampleFix":"// before\nschema { fields { name = string, name = int, id = long } }\n// after\nschema { fields { name = string, age = int, id = long } }","handlingStrategy":"validation","validationCode":"Set<String> seen = new HashSet<>(); for (String n : table.getTableSchema().getFieldNames()) { if (!seen.add(n)) throw new IllegalArgumentException(\"duplicate field: \" + n); }","typeGuard":"boolean hasDuplicate = Arrays.stream(schema.getFieldNames()).distinct().count() != (schema.getFieldNames() == null ? 0 : schema.getFieldNames().length);","tryCatchPattern":"try { factory.createAndPrepareSource(...) } catch (SeaTunnelException e) { if (e.getMessage().contains(\"duplicate\")) { log.error(\"duplicate schema field: {}\", e.getMessage()); } throw e; }","preventionTips":["De-duplicate columns when merging schemas","Rename colliding CDC columns with a Transform upstream","Add uniqueness assertions in catalog tests"],"tags":["schema","validation","duplicate-field","catalog-table"],"backgroundTag":"schema-validation-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}