{"record":{"id":"552820d2b21dca80","repo":"apache/seatunnel","slug":"fileconnectorerrorcode-data-deserialize-failed","errorCode":"FileConnectorErrorCode.DATA_DESERIALIZE_FAILED","errorMessage":"Deserialize this file [%s] failed, please check the origin data","messagePattern":"Deserialize this file \\[(.+?)\\] failed, please check the origin data","errorType":"error_code","errorClass":"FileConnectorException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/source/reader/CsvReadStrategy.java","lineNumber":173,"sourceCode":"                        fields[i] = seaTunnelRow.getField(indexes[i]);\n                    }\n                    seaTunnelRow = new SeaTunnelRow(fields);\n                }\n                if (isMergePartition) {\n                    int index = seaTunnelRowType.getTotalFields();\n                    for (String value : partitionsMap.values()) {\n                        seaTunnelRow.setField(index++, value);\n                    }\n                }\n                seaTunnelRow.setTableId(split.getTableId());\n                output.collect(seaTunnelRow);\n            }\n        } catch (IOException e) {\n            String errorMsg =\n                    String.format(\n                            \"Deserialize this file [%s] failed, please check the origin data\",\n                            currentFileName);\n            throw new FileConnectorException(\n                    FileConnectorErrorCode.DATA_DESERIALIZE_FAILED, errorMsg, e);\n        }\n    }\n\n    private InputStream wrapInputStream(InputStream inputStream, FileSourceSplit split)\n            throws IOException {\n        InputStream resultStream;\n        // process compression isnputStream\n        switch (compressFormat) {\n            case LZO:\n                LzopCodec lzo = new LzopCodec();\n                resultStream = lzo.createInputStream(inputStream);\n                break;\n            case NONE:\n                resultStream = inputStream;\n                break;\n            default:\n                log.warn(","sourceCodeStart":155,"sourceCodeEnd":191,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/source/reader/CsvReadStrategy.java#L155-L191","documentation":"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.","triggerScenarios":"Any IOException during CSV deserialization of a split: malformed records, unexpected EOF mid-record, underlying stream/decode errors, filesystem read interruption while parsing currentFileName.","commonSituations":"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.","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."],"exampleFix":"// before\ndelimiter = \";\"   # file actually uses commas\n// after\ndelimiter = \",\"","handlingStrategy":"try-catch","validationCode":"// Pre-validate one sample file with a strict CSV parser and configured delimiter/quote/encoding\ntry (CSVParser p = new CSVParser(new InputStreamReader(in, charset), format)) {\n    p.iterator().forEachRemaining(r -> {}); // throws on malformed records\n}","typeGuard":null,"tryCatchPattern":"try {\n    rows = readProcess(inputStream, partitionsMap, fileName);\n} catch (FileConnectorException e) {\n    if (e.getErrorCode() == FileConnectorErrorCode.DATA_DESERIALIZE_FAILED) {\n        log.error(\"CSV parse failed in {} — root cause: {}\", fileName, e.getCause(), e);\n    }\n    throw e;\n}","preventionTips":["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."],"tags":["csv","deserialize","data-quality"],"backgroundTag":"file-read-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}