apache/seatunnel · error · IndexOutOfBoundsException
The data does not match the configured schema information…
Error message
The data does not match the configured schema information, please check
What it means
TextSerializationSchema.serialize throws IndexOutOfBoundsException with this message when the incoming SeaTunnelRow's field count differs from the configured SeaTunnelRowType's total field count. The text format writes fields positionally against the declared schema, so mismatched arity cannot be serialized safely.
Solutions
- Compare element.getFields().length with the configured schema's totalFields to find where they diverge
- Fix the upstream transform/source so it emits exactly the declared number of fields
- Update the sink catalog table schema to match the actual row structure
- Insert a transform that pads/trims fields to the schema arity before serialization
Example fix
// before // transform drops a column -> row has 3 fields, schema expects 4 // after SeaTunnelRow out = new SeaTunnelRow(4); out.setField(3, defaultValue); // fill the removed column's slot
Defensive patterns
Strategy: validation
Validate before calling
if (element.getFields().length != seaTunnelRowType.getTotalFields()) {
throw new IllegalStateException("Row arity " + element.getFields().length
+ " != schema arity " + seaTunnelRowType.getTotalFields());
} Type guard
boolean matchesSchema(SeaTunnelRow row, SeaTunnelRowType type) {
return row.getFields() != null && row.getFields().length == type.getTotalFields();
} Try / catch
try {
byte[] out = textSchema.serialize(row);
} catch (IndexOutOfBoundsException e) {
log.error("Row/schema field count mismatch: {}", e.getMessage(), e);
throw e;
} Prevention
- Keep upstream transforms and sink catalog schemas in sync; change them together
- Assert row arity in a unit test for every transform stage
- Avoid dynamic column counts in text-format pipelines
When it happens
Trigger: Calling serialize with a row whose fields array length != seaTunnelRowType.getTotalFields() — e.g. an upstream transform added/removed columns, the source schema changed after the sink schema was fixed, or a manually built row with the wrong number of fields.
Common situations: Catalog table schema edited without updating the upstream transform; CDC pipelines where different event kinds produce different field counts; dynamic columns arriving that the static schema does not declare.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- COMMON-02
- The data does not match the configured schema information…
- UNSUPPORTED_DATA_TYPE
- array inject error, unsupported data type: " + type
- Can't find column in table.
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/00f2a3e7be0e6ebf.
Report an issue: GitHub.
Appendix: source
Thrown at seatunnel-formats/seatunnel-format-text/src/main/java/org/apache/seatunnel/format/text/TextSerializationSchema.java:160
}
public TextSerializationSchema build() {
return new TextSerializationSchema(
seaTunnelRowType,
separators,
dateFormatter,
dateTimeFormatter,
timeFormatter,
charset,
nullValue,
wallClockTimestampTz);
}
}
@Override
public byte[] serialize(SeaTunnelRow element) {
if (element.getFields().length != seaTunnelRowType.getTotalFields()) {
throw new IndexOutOfBoundsException(
"The data does not match the configured schema information, please check");
}
Object[] fields = element.getFields();
String[] strings = new String[fields.length];
for (int i = 0; i < fields.length; i++) {
strings[i] = convert(fields[i], seaTunnelRowType.getFieldType(i), 0);
}
return String.join(separators[0], strings).getBytes(charset);
}
private String convert(Object field, SeaTunnelDataType<?> fieldType, int level) {
if (field == null) {
return nullValue;
}
switch (fieldType.getSqlType()) {
case DOUBLE:
case FLOAT:
case INT:View on GitHub (pinned to cf67b549a7)