apache/seatunnel · error · IllegalArgumentException

The type " + type + " is not supported!

Error message

The type " + type + " is not supported!

What it means

SeaTunnelRowSerializer serializes SeaTunnelRow records into a payload format for SelectDB Cloud load. Only the 'json' and 'csv' formats (case-matched constants) are supported; any other configured value throws this IllegalArgumentException at the first row serialized.

Solutions

  1. Set the sink format option to exactly 'json' or 'csv' (match the constant values in the connector)
  2. Check the builder/config code that passes the format string to SeaTunnelRowSerializer and fix the value at the source
  3. If another format is genuinely needed, extend serialize() with a new branch and contribute it upstream

Example fix

// before
format = "JSON"; // throws IllegalArgumentException
// after
format = "json"; // matches JSON constant, uses buildJsonString
Defensive patterns

Strategy: validation

Validate before calling

if (!"json".equals(format) && !"csv".equals(format)) { throw new IllegalArgumentException("format must be json or csv, got: " + format); }

Try / catch

try { serializer.serialize(row); } catch (IllegalArgumentException e) { /* fix config, fail fast at startup */ }

Prevention

When it happens

Trigger: The sink's serializer format option (seaTunnelRowSerializerBuilder format) is set to a string other than JSON or CSV, e.g. 'parquet' or 'JSON' with different casing than the constants, and serialize() is invoked on the first record.

Common situations: Typo in the format config value; using uppercase 'JSON'/'CSV' when constants compare case-sensitively; copying config from another sink that supports more formats.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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

Appendix: source

Thrown at seatunnel-connectors-v2/connector-selectdb-cloud/src/main/java/org/apache/seatunnel/connectors/selectdb/serialize/SeaTunnelRowSerializer.java:67

            boolean enableDelete) {
        this.type = type;
        this.seaTunnelRowType = seaTunnelRowType;
        this.fieldDelimiter = fieldDelimiter;
        this.enableDelete = enableDelete;
        if (JSON.equals(type)) {
            objectMapper = new ObjectMapper();
        }
    }

    @Override
    public byte[] serialize(SeaTunnelRow seaTunnelRow) throws IOException {
        String valString;
        if (JSON.equals(type)) {
            valString = buildJsonString(seaTunnelRow);
        } else if (CSV.equals(type)) {
            valString = buildCSVString(seaTunnelRow);
        } else {
            throw new IllegalArgumentException("The type " + type + " is not supported!");
        }
        return valString.getBytes(StandardCharsets.UTF_8);
    }

    public String buildJsonString(SeaTunnelRow row) throws IOException {
        Map<String, Object> rowMap = new HashMap<>(row.getFields().length);

        for (int i = 0; i < row.getFields().length; i++) {
            Object value = convert(seaTunnelRowType.getFieldType(i), row.getField(i));
            rowMap.put(seaTunnelRowType.getFieldName(i), value);
        }
        if (enableDelete) {
            rowMap.put(LoadConstants.DORIS_DELETE_SIGN, parseDeleteSign(row.getRowKind()));
        }
        return objectMapper.writeValueAsString(rowMap);
    }

    public String buildCSVString(SeaTunnelRow row) throws IOException {

View on GitHub (pinned to cf67b549a7)