apache/seatunnel · error · AerospikeConnectorException

INVALID_CONFIG

INVALID_CONFIG

Error message

Field '' not found in source data

What it means

When the Aerospike sink option 'field_types' is set, AerospikeTypeConverter validates that every listed field actually exists in the SeaTunnelRowType (the schema of the incoming data). If a configured field name has no matching column in the row type (indexOf returns -1), it throws AerospikeConnectorException with code INVALID_CONFIG. This is a startup-time configuration validation that catches schema/config mismatches before any records are written.

Source

Thrown at seatunnel-connectors-v2/connector-aerospike/src/main/java/org/apache/seatunnel/connectors/seatunnel/aerospike/sink/AerospikeTypeConverter.java:59

    public AerospikeTypeConverter(SeaTunnelRowType rowType, ReadonlyConfig config) {
        this.fieldTypeMapping = new HashMap<>();
        Map<String, String> configFieldTypes = config.get(AerospikeSinkOptions.FIELD_TYPES);

        if (configFieldTypes == null || configFieldTypes.isEmpty()) {
            String[] allFields = rowType.getFieldNames();
            this.fieldNames = Arrays.asList(allFields);
            for (String field : allFields) {
                int index = rowType.indexOf(field);
                SeaTunnelDataType<?> seaTunnelType = rowType.getFieldType(index);
                fieldTypeMapping.put(field, mapSeaTunnelType(seaTunnelType));
            }
        } else {
            this.fieldNames = new ArrayList<>(configFieldTypes.keySet());
            for (String fieldName : configFieldTypes.keySet()) {
                int index = rowType.indexOf(fieldName);
                if (index == -1) {
                    throw new AerospikeConnectorException(
                            AerospikeErrorCode.INVALID_CONFIG,
                            "Field '" + fieldName + "' not found in source data");
                }
                fieldTypeMapping.put(
                        fieldName, AerospikeDataType.valueOf(configFieldTypes.get(fieldName)));
            }
        }
    }

    private AerospikeDataType mapSeaTunnelType(SeaTunnelDataType<?> seaTunnelType) {
        switch (seaTunnelType.getSqlType()) {
            case STRING:
                return AerospikeDataType.STRING;
            case INT:
                return AerospikeDataType.INTEGER;
            case BIGINT:
                return AerospikeDataType.LONG;
            case DOUBLE:

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Compare each key in the 'field_types' config against the actual field names in your source schema and fix the spelling/case to match exactly.
  2. Remove stale entries in field_types for columns that no longer exist upstream.
  3. Print/inspect the row type (e.g. via the job's schema or a FakeSource/print sink) to confirm the exact field names, then align the config.
  4. If you want all schema fields written automatically, delete the field_types option entirely so the converter derives mappings from the row type.

Example fix

// before
field_types = {usr_name = STRING}

// after (schema has 'user_name')
field_types = {user_name = STRING}
Defensive patterns

Strategy: validation

Validate before calling

for (String fieldName : configFieldTypes.keySet()) {
    if (rowType.indexOf(fieldName) == -1) {
        throw new IllegalArgumentException("field_types key '" + fieldName
            + "' not in schema: " + java.util.Arrays.toString(rowType.getFieldNames()));
    }
}

Try / catch

try {
    new AerospikeTypeConverter(rowType, config);
} catch (AerospikeConnectorException e) {
    if (e.getCode() == AerospikeErrorCode.INVALID_CONFIG
            && e.getMessage().contains("not found in source data")) {
        // fix field_types keys to match rowType.getFieldNames() and retry
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: Constructing AerospikeTypeConverter(rowType, config) where config's FIELD_TYPES map contains a key that does not match any field name in the row type — typically a typo, a case mismatch (matching is exact), or a field that was removed/renamed upstream.

Common situations: Typo in field_types key (e.g. 'user_id' vs 'userId'); renaming a column upstream without updating the sink config; relying on case-insensitive matching that the connector does not do; copying configs between jobs whose schemas differ; the empty string '' key in field_types from a mis-edited HOCON map.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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