apache/seatunnel · error · FileConnectorException
FileConnectorErrorCode.DATA_DESERIALIZE_FAILED
FileConnectorErrorCode.DATA_DESERIALIZE_FAILED
Error message
Deserialize this file [%s] failed, please check the origin data
What it means
CsvReadStrategy.readProcess wraps IOExceptions raised while reading/deserializing the CSV into FileConnectorException with FileConnectorErrorCode.DATA_DESERIALIZE_FAILED, telling the user to check the origin data. The original IOException is attached as the cause, so the true failure (malformed quoting, encoding, truncated read) is one level down.
Source
Thrown at seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/source/reader/CsvReadStrategy.java:173
fields[i] = seaTunnelRow.getField(indexes[i]);
}
seaTunnelRow = new SeaTunnelRow(fields);
}
if (isMergePartition) {
int index = seaTunnelRowType.getTotalFields();
for (String value : partitionsMap.values()) {
seaTunnelRow.setField(index++, value);
}
}
seaTunnelRow.setTableId(split.getTableId());
output.collect(seaTunnelRow);
}
} catch (IOException e) {
String errorMsg =
String.format(
"Deserialize this file [%s] failed, please check the origin data",
currentFileName);
throw new FileConnectorException(
FileConnectorErrorCode.DATA_DESERIALIZE_FAILED, errorMsg, e);
}
}
private InputStream wrapInputStream(InputStream inputStream, FileSourceSplit split)
throws IOException {
InputStream resultStream;
// process compression isnputStream
switch (compressFormat) {
case LZO:
LzopCodec lzo = new LzopCodec();
resultStream = lzo.createInputStream(inputStream);
break;
case NONE:
resultStream = inputStream;
break;
default:
log.warn(View on GitHub (pinned to cf67b549a7)
Solutions
- Open the 'Caused by' exception and inspect the offending line in currentFileName.
- Match delimiter, quote_char, and encoding options to the actual file format.
- Fix or re-export the corrupt source file; validate it with a CSV parser locally.
Example fix
// before delimiter = ";" # file actually uses commas // after delimiter = ","
Defensive patterns
Strategy: try-catch
Validate before calling
// Pre-validate one sample file with a strict CSV parser and configured delimiter/quote/encoding
try (CSVParser p = new CSVParser(new InputStreamReader(in, charset), format)) {
p.iterator().forEachRemaining(r -> {}); // throws on malformed records
} Try / catch
try {
rows = readProcess(inputStream, partitionsMap, fileName);
} catch (FileConnectorException e) {
if (e.getErrorCode() == FileConnectorErrorCode.DATA_DESERIALIZE_FAILED) {
log.error("CSV parse failed in {} — root cause: {}", fileName, e.getCause(), e);
}
throw e;
} Prevention
- Match delimiter, quote_char, and encoding options to the real file content.
- Run a local strict CSV validation on source data before ingesting.
- Watch for truncated files and mid-record EOFs from interrupted uploads.
When it happens
Trigger: Any IOException during CSV deserialization of a split: malformed records, unexpected EOF mid-record, underlying stream/decode errors, filesystem read interruption while parsing currentFileName.
Common situations: CSV files with broken quotes or wrong delimiter; files encoded in GBK/UTF-16 read as UTF-8; truncated uploads; delimiter/quote_char config not matching actual data causing parse overflow errors.
Understand the failure class
Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.
Related errors
- RULE_VALIDATION_FAILED
- STREAM_LOAD_FAILED
- STREAM_LOAD_FAILED
- File [%s] has fewer lines than expected to skip.
- SeaTunnelAPIErrorCode.CONFIG_VALIDATION_FAILED
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/552820d2b21dca80.
Report an issue: GitHub.