{"record":{"id":"36a94227c7f8f3d1","repo":"apache/flink","slug":"fail-to-deserialize-at-field-s","errorCode":null,"errorMessage":"Fail to deserialize at field: %s.","messagePattern":"Fail to deserialize at field: (.+?)\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"flink-formats/flink-csv/src/main/java/org/apache/flink/formats/csv/CsvToRowDataConverters.java","lineNumber":112,"sourceCode":"            }\n\n            GenericRowData row = new GenericRowData(arity);\n            for (int i = 0; i < arity; i++) {\n                JsonNode field;\n                // Jackson only supports mapping by name in the first level\n                if (isTopLevel) {\n                    field = jsonNode.get(fieldNames[i]);\n                } else {\n                    field = jsonNode.get(i);\n                }\n                try {\n                    if (field == null) {\n                        row.setField(i, null);\n                    } else {\n                        row.setField(i, fieldConverters[i].convert(field));\n                    }\n                } catch (Throwable t) {\n                    throw new RuntimeException(\n                            String.format(\"Fail to deserialize at field: %s.\", fieldNames[i]), t);\n                }\n            }\n            return row;\n        };\n    }\n\n    /** Creates a runtime converter which is null safe. */\n    private CsvToRowDataConverter createNullableConverter(LogicalType type) {\n        final CsvToRowDataConverter converter = createConverter(type);\n        return jsonNode -> {\n            if (jsonNode == null || jsonNode.isNull()) {\n                return null;\n            }\n            try {\n                return converter.convert(jsonNode);\n            } catch (Throwable t) {\n                if (!ignoreParseErrors) {","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-formats/flink-csv/src/main/java/org/apache/flink/formats/csv/CsvToRowDataConverters.java#L94-L130","documentation":"Per-field error context in CsvToRowDataConverters.createRowConverter: when converting one field of a CSV row, any Throwable from the field's converter (bad number, bad date/time string, wrong node type) is caught and re-thrown as RuntimeException naming the failing field ('Fail to deserialize at field: %s.'). This pinpoints which column of the CSV row is malformed; the cause holds the precise parse failure. Typically it then bubbles up to error 1331's 'Failed to deserialize CSV row' handler.","triggerScenarios":"A specific column value incompatible with its declared type: '2023-13-45' for DATE, 'abc' for INT, '1,234' (locale thousands separator) for DOUBLE, an empty string for a non-nullable primitive parsed strictly, or a quoted fragment breaking array element parsing.","commonSituations":"Mixed-quality producer data; timezone/locale formatting of timestamps; CSV files where nulls are encoded as empty strings but the column is declared NOT NULL primitive.","solutions":["Read the field name in the message and the chained cause, then fix that column's value or producer formatting.","For tolerant pipelines set 'csv.ignore-parse-errors'='true' so bad rows are skipped instead of failing the job.","Declare nullable columns where empty strings appear, or pre-emptively CAST to STRING and validate downstream.","Match 'csv.timestamp-format'/'csv.date-format'/'csv.time-format' options to the actual string shapes."],"exampleFix":"-- before\n'format'='csv'  -- job dies on '2023-13-45' in dt column\n\n-- after\n'format'='csv',\n'csv.ignore-parse-errors'='true'","handlingStrategy":"fallback","validationCode":"-- Sample-based validation before production:\n-- SELECT COUNT(*) FROM csv_t WHERE NOT <type predicate per column> (e.g. ts REGEXP '^\\\\d{4}-\\\\d{2}-\\\\d{2}$');\n-- Configure explicit formats when the shape is known:\n-- 'csv.date-format'='yyyy-MM-dd', 'csv.time-format'='HH:mm:ss'","typeGuard":null,"tryCatchPattern":"catch (RuntimeException e) { if (e.getMessage().startsWith(\"Fail to deserialize at field:\")) { /* extract field name, route row to DLQ or skip when ignore-parse-errors=true */ } throw e; }","preventionTips":["Set csv date/time format options to match the producer","Declare nullable columns where empties occur","Enable ignore-parse-errors for tolerant pipelines and monitor skip rates"],"tags":["csv","parsing","field-conversion","dirty-data"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}