apache/seatunnel · error · MongodbConnectorException

UNSUPPORTED_DATA_TYPE

UNSUPPORTED_DATA_TYPE

Error message

Not support to parse type: ${type}

What it means

createInternalConverter is the row-to-BSON type dispatcher in RowDataToBsonConverters; it supports NULL, boolean, numeric, string, bytes, array, map, and row types. Any other SeaTunnel type falling into the default branch (e.g. DATE/TIME variants not matched above, or custom types) is rejected with UNSUPPORTED_DATA_TYPE since there is no defined BSON representation.

Source

Thrown at seatunnel-connectors-v2/connector-mongodb/src/main/java/org/apache/seatunnel/connectors/seatunnel/mongodb/serde/RowDataToBsonConverters.java:251

                        return new BsonDecimal128(
                                new Decimal128(
                                        Objects.requireNonNull(
                                                fromBigDecimal(
                                                        decimalVal,
                                                        decimalType.getPrecision(),
                                                        decimalType.getScale()))));
                    }
                };
            case ARRAY:
                return createArrayConverter((ArrayType<?, ?>) type);
            case MAP:
                MapType<?, ?> mapType = (MapType<?, ?>) type;
                return createMapConverter(
                        mapType.toString(), mapType.getKeyType(), mapType.getValueType());
            case ROW:
                return createRowConverter((SeaTunnelRowType) type);
            default:
                throw new MongodbConnectorException(
                        UNSUPPORTED_DATA_TYPE, "Not support to parse type: " + type);
        }
    }

    private static SerializableFunction<Object, BsonValue> createArrayConverter(
            ArrayType<?, ?> arrayType) {
        final SerializableFunction<Object, BsonValue> elementConverter =
                createNullSafeInternalConverter(arrayType.getElementType());

        return new SerializableFunction<Object, BsonValue>() {
            private static final long serialVersionUID = 1L;

            @Override
            public BsonValue apply(Object value) {
                Object[] arrayData = (Object[]) value;
                final List<BsonValue> bsonValues = new ArrayList<>();
                for (Object element : arrayData) {
                    bsonValues.add(elementConverter.apply(element));

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Change the unsupported column to a supported type (INT/BIGINT/DOUBLE/DECIMAL/STRING/BYTES/BOOLEAN/ARRAY/MAP/ROW).
  2. Pre-convert the column to a string or timestamp-compatible type in a transform before the sink.
  3. Split the table so unsupported columns are written by a different connector.
  4. If the type should be supported, extend createInternalConverter with a converter (contribute a fix).

Example fix

// before: schema uses a type with no BSON mapping
SeaTunnelRowType.of(new String[]{"ts"}, new SeaTunnelDataType<?>[]{LocalTimeType.LOCAL_DATE_TIME})
// after: cast to a supported type before the sink
SeaTunnelRowType.of(new String[]{"ts"}, new SeaTunnelDataType<?>[]{StringType.INSTANCE}) // write ISO string
Defensive patterns

Strategy: validation

Validate before calling

// pre-validate schema types are BSON-mappable
Set<SqlType> supported = Set.of(BOOLEAN, TINYINT, SMALLINT, INT, BIGINT, FLOAT, DOUBLE, DECIMAL, STRING, BYTES, ARRAY, MAP, ROW); // verify each field type before sink

Try / catch

try { sink.write(row); } catch (MongodbConnectorException e) { if (e.getMessage().startsWith("Not support to parse type")) { log.error("Schema contains unsupported type for MongoDB sink: " + e.getMessage()); throw e; } throw e; }

Prevention

When it happens

Trigger: Writing a SeaTunnel table whose schema contains a type unsupported by the MongoDB BSON converter; createNullSafeInternalConverter delegates to createInternalConverter which hits the default case for that type.

Common situations: Schemas with DATE/TIME or other exotic types passed to the MongoDB sink after a schema change; auto-generated schemas from upstream sources containing types the connector never added converters for; copy-pasted sink definitions across connectors.

Related errors


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