apache/seatunnel · error · IllegalArgumentException

Unsupported data format type:

Error message

Unsupported data format type: 

What it means

In AerospikeSinkWriter.write, a switch on the configured formatType builds Aerospike Bins; the default branch throws IllegalArgumentException 'Unsupported data format type: <formatType>' for format types the writer has no conversion logic for. Unlike the generic write failure path, this indicates a config/enum gap rather than an I/O problem.

Source

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

                    break;

                case KV:
                    Map<String, Object> fieldsMap =
                            JSON.parseObject(data, new TypeReference<Map<String, Object>>() {});
                    List<Bin> bins = new ArrayList<>();
                    Map<String, String> configFieldTypes =
                            config.get(AerospikeSinkOptions.FIELD_TYPES);
                    for (String fieldName : configFieldTypes.keySet()) {
                        Object value = fieldsMap.get(fieldName);
                        AerospikeDataType dataType = typeConverter.getFieldType(fieldName);
                        Object convertedValue = convertValue(value, dataType);
                        bins.add(new Bin(fieldName, convertedValue));
                    }
                    aerospikeClient.put(writePolicy, aerospikeKey, bins.toArray(new Bin[0]));
                    break;

                default:
                    throw new IllegalArgumentException(
                            "Unsupported data format type: " + formatType);
            }
        } catch (Exception e) {
            throw new AerospikeConnectorException(
                    AerospikeErrorCode.WRITER_OPERATION_FAILED, "Failed to write record", e);
        }
    }

    @Override
    public void close() throws IOException {
        try {
            if (Objects.nonNull(aerospikeClient)) {
                aerospikeClient.close();
            }
        } catch (Exception e) {
            throw new AerospikeConnectorException(
                    AerospikeErrorCode.WRITER_CLOSE_FAILED, "Failed to close writer", e);
        }

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Set the sink format to a supported type (json or string)
  2. Check the writer switch in AerospikeSinkWriter.write to see which formatTypes are actually handled
  3. Upgrade or downgrade connector versions so the enum and the writer logic match
  4. File an issue if a documented format is not handled

Example fix

// before
format = jsonline
// after
format = json
Defensive patterns

Strategy: validation

Validate before calling

if (formatType != DataFormatType.JSON && formatType != DataFormatType.STRING) throw new IllegalArgumentException("format not supported by aerospike sink: " + formatType);

Try / catch

try { writer.write(row); } catch (AerospikeConnectorException e) { if (e.getCause() instanceof IllegalArgumentException && e.getCause().getMessage().startsWith("Unsupported data format type")) { /* fix config, abort job */ } }

Prevention

When it happens

Trigger: Configuring an aerospike sink with a DataFormatType that has no case in the write switch (e.g. a newly added enum value not handled by the writer), so the default branch executes while putting a record.

Common situations: Using a format option valid in another connector; connector version mismatch where the enum gained a value the writer switch doesn't handle; typos avoided by the enum but unsupported values still reach here.

Related errors


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