apache/seatunnel · error · CassandraConnectorException

FIELD_NOT_IN_TABLE

FIELD_NOT_IN_TABLE

Error message

Field " + field + " does not exist in table " + pluginConfig.get(TABLE)

What it means

CassandraSink validates each user-configured field against the live table schema (ColumnDefinitions.contains(field)); if a configured field is not a real column, it throws FIELD_NOT_IN_TABLE naming the field and table. This fails fast before any writes are attempted, since CQL inserts would fail anyway.

Source

Thrown at seatunnel-connectors-v2/connector-cassandra/src/main/java/org/apache/seatunnel/connectors/seatunnel/cassandra/sink/CassandraSink.java:75

                CassandraClient.getCqlSessionBuilder(
                                cassandraParameters.getHost(),
                                cassandraParameters.getKeyspace(),
                                cassandraParameters.getUsername(),
                                cassandraParameters.getPassword(),
                                cassandraParameters.getDatacenter())
                        .build()) {
            List<String> fields = cassandraParameters.getFields();
            this.tableSchema = CassandraClient.getTableSchema(session, pluginConfig.get(TABLE));
            if (fields == null || fields.isEmpty()) {
                List<String> newFields = new ArrayList<>();
                for (int i = 0; i < tableSchema.size(); i++) {
                    newFields.add(tableSchema.get(i).getName().asInternal());
                }
                this.cassandraParameters.setFields(newFields);
            } else {
                for (String field : fields) {
                    if (!tableSchema.contains(field)) {
                        throw new CassandraConnectorException(
                                CassandraConnectorErrorCode.FIELD_NOT_IN_TABLE,
                                "Field "
                                        + field
                                        + " does not exist in table "
                                        + pluginConfig.get(TABLE));
                    }
                }
            }
        } catch (Exception e) {
            throw new CassandraConnectorException(
                    SeaTunnelAPIErrorCode.CONFIG_VALIDATION_FAILED,
                    String.format(
                            "PluginName: %s, PluginType: %s, Message: %s",
                            getPluginName(), PluginType.SINK, ExceptionUtils.getMessage(e)));
        }
    }

    @Override

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Fix the field name in the sink `fields` config to exactly match the table column (run `DESCRIBE TABLE` to copy exact names).
  2. Remember unquoted identifiers are lowercased by Cassandra; if the column was created quoted with capitals, quote it identically in config.
  3. If the schema changed, update the config or re-add the missing column via ALTER TABLE.
  4. Ensure the config's table (and keyspace) is the one you intend — a wrong keyspace makes valid columns look nonexistent.

Example fix

// before
fields = ["Id", "Name"]
// after (unquoted Cassandra columns are lowercase)
fields = ["id", "name"]
Defensive patterns

Strategy: validation

Validate before calling

// compare config fields against live schema before deploying
cqlsh -e "DESCRIBE TABLE ${KEYSPACE}.${TABLE}" | grep -E '\| *(${FIELD1}|${FIELD2}) *\|'

Try / catch

// fail fast with field name in message
try {
    sink.validate(cfg);
} catch (CassandraConnectorException e) {
    if (CassandraConnectorErrorCode.FIELD_NOT_IN_TABLE.equals(e.getErrorCode())) {
        throw new IllegalArgumentException("Fix fields config: " + e.getMessage());
    } throw e;
}

Prevention

When it happens

Trigger: In the CassandraSink constructor, a name in the `fields` config list is not found in the table's ColumnDefinitions obtained from CassandraClient.getTableSchema.

Common situations: Typo or wrong case in a column name (Cassandra identifiers are case-sensitive when quoted); schema changed since config was written (column renamed/dropped); fields list referencing columns from a different table/keyspace.

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/461a903e4b1dcddd. Report an issue: GitHub.