apache/seatunnel · error · CouchbaseConnectorException

UNSUPPORTED_TYPE

UNSUPPORTED_TYPE

Error message

Unsupported SeaTunnel type for Couchbase sink: {sqlType}. Field: {key}

What it means

putValue() maps each row field into a JSON document; the default branch rejects SeaTunnel types the Couchbase sink cannot serialize, reporting the SQL type and field name. Only primitive, array, map and row types are handled — anything else (or an unexpected type) triggers UNSUPPORTED_TYPE.

Source

Thrown at seatunnel-connectors-v2/connector-couchbase/src/main/java/org/apache/seatunnel/connectors/seatunnel/couchbase/sink/CouchbaseWriter.java:316

            case TIME:
            case TIMESTAMP:
                doc.put(key, value.toString());
                break;
            case BYTES:
                // Couchbase JSON does not natively encode byte arrays; store as Base64 string.
                doc.put(key, java.util.Base64.getEncoder().encodeToString((byte[]) value));
                break;
            case ARRAY:
                doc.put(key, toJsonArray((Object[]) value, (ArrayType<?, ?>) dataType));
                break;
            case MAP:
                doc.put(key, toJsonObjectFromMap((Map<?, ?>) value, (MapType<?, ?>) dataType));
                break;
            case ROW:
                doc.put(key, toJsonObject((SeaTunnelRow) value, (SeaTunnelRowType) dataType));
                break;
            default:
                throw new CouchbaseConnectorException(
                        CouchbaseConnectorErrorCode.UNSUPPORTED_TYPE,
                        "Unsupported SeaTunnel type for Couchbase sink: "
                                + dataType.getSqlType()
                                + ". Field: "
                                + key);
        }
    }

    /**
     * Converts an array value to a {@link JsonArray}, recursively converting each element according
     * to the declared element type.
     */
    private JsonArray toJsonArray(Object[] elements, ArrayType<?, ?> arrayType) {
        SeaTunnelDataType<?> elementType = arrayType.getElementType();
        JsonArray arr = JsonArray.create();
        for (Object element : elements) {
            if (element == null) {
                arr.add((Object) null);

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Change the offending field's type to a supported type (string, int, long, double, boolean, bytes, date, time, timestamp, array, map, row)
  2. Cast/coerce the field in a transform before the sink (e.g. CAST(col AS STRING))
  3. Upgrade SeaTunnel/connector in case the type is newly supported

Example fix

// before
query = "select * from src" // src.bin is BYTES-heavy custom type
// after
query = "select CAST(bin_col AS STRING) AS bin_col, * from src"
Defensive patterns

Strategy: validation

Validate before calling

java
Set<SqlType> supported = Set.of(STRING, INT, BIGINT, DOUBLE, BOOLEAN, BYTES, DATE, TIME, TIMESTAMP, ARRAY, MAP, ROW);
for (SeaTunnelDataType<?> t : rowType.getFieldTypes()) {
    if (!supported.contains(t.getSqlType())) throw new IllegalStateException("unsupported: " + t.getSqlType());
}

Prevention

When it happens

Trigger: A schema field whose SeaTunnel type falls into putValue's default branch (unhandled sqlType) reaching toJsonObject; schema evolved to include a type the sink's serializer doesn't cover.

Common situations: Using newer SeaTunnel types (e.g. TimeType variants or custom types) not yet mapped in the Couchbase writer; schema inferred from a source emitting exotic types.

Related errors


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