apache/seatunnel · error · SeaTunnelException

Table field duplicate

Error message

Table %s field %s duplicate

What it means

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.

Solutions

  1. Remove or rename the duplicate field in the schema so all names are unique.
  2. Use a Transform (e.g. Replace/SQL) to rename one of the colliding upstream columns before the sink.
  3. If building CatalogTable in code, de-duplicate field names when constructing TableSchema.
  4. Check which connector/catalog produced the duplicated column and fix its column derivation.

Example fix

// before
schema { fields { name = string, name = int, id = long } }
// after
schema { fields { name = string, age = int, id = long } }
Defensive patterns

Strategy: validation

Validate before calling

Set<String> seen = new HashSet<>(); for (String n : table.getTableSchema().getFieldNames()) { if (!seen.add(n)) throw new IllegalArgumentException("duplicate field: " + n); }

Type guard

boolean hasDuplicate = Arrays.stream(schema.getFieldNames()).distinct().count() != (schema.getFieldNames() == null ? 0 : schema.getFieldNames().length);

Try / catch

try { factory.createAndPrepareSource(...) } catch (SeaTunnelException e) { if (e.getMessage().contains("duplicate")) { log.error("duplicate schema field: {}", e.getMessage()); } throw e; }

Prevention

When it happens

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

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

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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

Appendix: source

Thrown at seatunnel-api/src/main/java/org/apache/seatunnel/api/table/factory/TableFactoryContext.java:53

    private final ClassLoader classLoader;

    public TableFactoryContext(ReadonlyConfig options, ClassLoader classLoader) {
        this.options = options;
        this.classLoader = classLoader;
    }

    protected static void checkCatalogTableIllegal(List<CatalogTable> catalogTables) {
        for (CatalogTable catalogTable : catalogTables) {
            List<String> alreadyChecked = new ArrayList<>();
            for (String fieldName : catalogTable.getTableSchema().getFieldNames()) {
                if (StringUtils.isBlank(fieldName)) {
                    throw new SeaTunnelException(
                            String.format(
                                    "Table %s field name cannot be empty",
                                    catalogTable.getTablePath().getFullName()));
                }
                if (alreadyChecked.contains(fieldName)) {
                    throw new SeaTunnelException(
                            String.format(
                                    "Table %s field %s duplicate",
                                    catalogTable.getTablePath().getFullName(), fieldName));
                }
                alreadyChecked.add(fieldName);
            }
        }
    }
}

View on GitHub (pinned to cf67b549a7)