apache/seatunnel · error · IllegalArgumentException

Can't find column ${col} in table.

Error message

Can't find column ${col} in table.

What it means

DorisCatalogUtil.mergeColumnInTemplate fails to locate a column name from the SeaTunnel table schema inside the Doris table template string being modified. When a column referenced for merge/replacement cannot be matched in the template text, it throws this IllegalArgumentException. It is a string-based template manipulation, so exact-name matching is required.

Source

Thrown at seatunnel-connectors-v2/connector-doris/src/main/java/org/apache/seatunnel/connectors/doris/util/DorisCatalogUtil.java:273

            String col = columnInfo.getName();
            if (StringUtils.isEmpty(columnInfo.getInfo())) {
                if (columnMap.containsKey(col)) {
                    Column column = columnMap.get(col);
                    String newCol = columnToDorisType(column, typeConverter);
                    String prefix = template.substring(0, columnInfo.getStartIndex() + offset);
                    String suffix = template.substring(offset + columnInfo.getEndIndex());
                    if (prefix.endsWith("`")) {
                        prefix = prefix.substring(0, prefix.length() - 1);
                        offset--;
                    }
                    if (suffix.startsWith("`")) {
                        suffix = suffix.substring(1);
                        offset--;
                    }
                    template = prefix + newCol + suffix;
                    offset += newCol.length() - columnInfo.getName().length();
                } else {
                    throw new IllegalArgumentException("Can't find column " + col + " in table.");
                }
            }
        }
        return template;
    }

    static String columnToDorisType(Column column, TypeConverter<BasicTypeDefine> typeConverter) {
        checkNotNull(column, "The column is required.");
        String columnType;
        if (column.getSinkType() != null) {
            columnType = column.getSinkType();
        } else {
            columnType = typeConverter.reconvert(column).getColumnType();
        }
        return String.format(
                "`%s` %s %s %s",
                column.getName(),
                columnType,

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Ensure column names in the SeaTunnel schema exactly match those in the Doris table template (case, spelling, quoting).
  2. Check the template string for extra spaces or backticks that break the substring match in mergeColumnInTemplate.
  3. Sync the schema: drop and recreate the Doris table from the current SeaTunnel schema.
  4. If schema evolution removed a column from Doris, re-add it or remove it from the source schema before calling catalog createTable.

Example fix

// before
// schema has column 'userId', Doris template has 'user_id'
// -> IllegalArgumentException: Can't find column userId in table.
// after
// align schema field name with the template column
SeatTunnelRowType rowType = new SeaTunnelRowType(
    new String[]{"user_id"},
    new SeaTunnelDataType<?>[]{BasicType.STRING_TYPE});
Defensive patterns

Strategy: validation

Validate before calling

// verify every schema column appears in the Doris template
for (String col : rowType.getFieldNames()) {
    if (!template.contains(col)) {
        throw new IllegalStateException("Column missing from Doris template: " + col);
    }
}

Type guard

boolean templateHasColumn(String template, String col) {
    return template != null && col != null && template.contains(col);
}

Try / catch

try {
    String stmt = DorisCatalogUtil.getCreateTableStatement(...);
} catch (IllegalArgumentException e) {
    if (e.getMessage().startsWith("Can't find column")) {
        // log offending column, sync schema, retry
    } else throw e;
}

Prevention

When it happens

Trigger: getCreateTableStatement is called with an existing table template whose column list does not contain one of the columns in the SeaTunnel TableSchema (e.g. column renamed, case mismatch, or the template column was removed or renamed in Doris).

Common situations: Schema drift between SeaTunnel config and the Doris template; column names differing only in case or backtick/spacing; manually edited template strings; schema evolution where a column was dropped in Doris but still present in the SeaTunnel schema.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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