apache/seatunnel · error · MongodbConnectorException
ILLEGAL_ARGUMENT
ILLEGAL_ARGUMENT
Error message
fieldName is empty
What it means
Constructor validation of DocumentRowDataDeserializer: the fieldNames array must be non-null and contain at least one column, because the deserializer maps every BSON document onto a SeaTunnelRow with those field names. An empty or null array makes row mapping impossible, so construction fails fast.
Source
Thrown at seatunnel-connectors-v2/connector-mongodb/src/main/java/org/apache/seatunnel/connectors/seatunnel/mongodb/serde/DocumentRowDataDeserializer.java:45
import static org.apache.seatunnel.api.table.type.SqlType.STRING;
import static org.apache.seatunnel.common.exception.CommonErrorCodeDeprecated.ILLEGAL_ARGUMENT;
import static org.apache.seatunnel.common.exception.CommonErrorCodeDeprecated.UNSUPPORTED_OPERATION;
public class DocumentRowDataDeserializer implements DocumentDeserializer<SeaTunnelRow> {
private final String[] fieldNames;
private final SeaTunnelDataType<?>[] fieldTypes;
private final BsonToRowDataConverters bsonConverters;
private final boolean flatSyncString;
public DocumentRowDataDeserializer(
String[] fieldNames, SeaTunnelDataType<?> dataTypes, boolean flatSyncString) {
if (fieldNames == null || fieldNames.length < 1) {
throw new MongodbConnectorException(ILLEGAL_ARGUMENT, "fieldName is empty");
}
this.bsonConverters = new BsonToRowDataConverters();
this.fieldNames = fieldNames;
this.fieldTypes = ((SeaTunnelRowType) dataTypes).getFieldTypes();
this.flatSyncString = flatSyncString;
}
@Override
public SeaTunnelRow deserialize(BsonDocument bsonDocument) {
if (flatSyncString) {
if (fieldNames.length != 1 && fieldTypes[0].getSqlType() != STRING) {
throw new MongodbConnectorException(
UNSUPPORTED_OPERATION,
"By utilizing flatSyncString, only one field attribute value can be set, and the field type must be a String. This operation will perform a string mapping on a single MongoDB data entry.");
}
SeaTunnelRow rowData = new SeaTunnelRow(fieldNames.length);
rowData.setField(
0, bsonConverters.createConverter(fieldTypes[0]).convert(bsonDocument));View on GitHub (pinned to cf67b549a7)
Solutions
- Provide a non-empty field list in the connector schema config (e.g. define 'schema' fields in the MongoDB source options).
- Verify the SeaTunnelRowType passed to the deserializer has at least one field.
- Check any query/projection options that could yield an empty column set.
- If fields are derived dynamically, add a fallback/default field set before constructing the deserializer.
Example fix
// before
new DocumentRowDataDeserializer(new String[0], rowType, false) // throws
// after
new DocumentRowDataDeserializer(new String[]{"_id", "name"}, rowType, false) Defensive patterns
Strategy: validation
Validate before calling
// validate before construction
if (fieldNames == null || fieldNames.length == 0) { throw new IllegalArgumentException("at least one field is required"); } Try / catch
try { deserializer = new DocumentRowDataDeserializer(fieldNames, rowType, flatSyncString); } catch (MongodbConnectorException e) { if (e.getMessage().equals("fieldName is empty")) { fieldNames = defaultFieldNames(); deserializer = new DocumentRowDataDeserializer(fieldNames, rowType, flatSyncString); } else { throw e; } } Prevention
- Always define at least one field in the MongoDB source schema config
- Check that dynamic schema discovery cannot produce an empty column list
- Log/validate the resolved SeaTunnelRowType before creating deserializers
- Review projection options that may strip all fields
When it happens
Trigger: Instantiating DocumentRowDataDeserializer with fieldNames == null or fieldNames.length == 0 — typically from a source connector built with an empty catalog table / query projection that resolved to zero columns.
Common situations: MongoDB source config where the 'schema'/'fields' option parses to an empty list; programmatic use of the connector API with an unpopulated SeaTunnelRowType; a projection/collection filter that matched no fields.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- FILE_SPLIT_SIZE_ILLEGAL
- UNSUPPORTED_DATA_TYPE
- ILLEGAL_ARGUMENT
- UNSUPPORTED_OPERATION
- UNSUPPORTED_DATA_TYPE
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/a01650b2656964f6.
Report an issue: GitHub.