{"record":{"id":"35f29d4f8beea657","repo":"apache/flink","slug":"fail-to-deserialize-at-field-s-35f29d","errorCode":null,"errorMessage":"Fail to deserialize at field: %s.","messagePattern":"Fail to deserialize at field: (.+?)\\.","errorType":"exception","errorClass":"JsonParseException","httpStatus":null,"severity":"error","filePath":"flink-formats/flink-json/src/main/java/org/apache/flink/formats/json/JsonToRowDataConverters.java","lineNumber":365,"sourceCode":"        final JsonToRowDataConverter[] fieldConverters =\n                rowType.getFields().stream()\n                        .map(RowType.RowField::getType)\n                        .map(this::createConverter)\n                        .toArray(JsonToRowDataConverter[]::new);\n        final String[] fieldNames = rowType.getFieldNames().toArray(new String[0]);\n\n        return jsonNode -> {\n            ObjectNode node = (ObjectNode) jsonNode;\n            int arity = fieldNames.length;\n            GenericRowData row = new GenericRowData(arity);\n            for (int i = 0; i < arity; i++) {\n                String fieldName = fieldNames[i];\n                JsonNode field = node.get(fieldName);\n                try {\n                    Object convertedField = convertField(fieldConverters[i], fieldName, field);\n                    row.setField(i, convertedField);\n                } catch (Throwable t) {\n                    throw new JsonParseException(\n                            String.format(\"Fail to deserialize at field: %s.\", fieldName), t);\n                }\n            }\n            return row;\n        };\n    }\n\n    private Object convertField(\n            JsonToRowDataConverter fieldConverter, String fieldName, JsonNode field) {\n        if (field == null) {\n            if (failOnMissingField) {\n                throw new JsonParseException(\"Could not find field with name '\" + fieldName + \"'.\");\n            } else {\n                return null;\n            }\n        } else {\n            return fieldConverter.convert(field);\n        }","sourceCodeStart":347,"sourceCodeEnd":383,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-formats/flink-json/src/main/java/org/apache/flink/formats/json/JsonToRowDataConverters.java#L347-L383","documentation":"Thrown by the ROW converter in JsonToRowDataConverters when any per-field converter throws while converting one field of a JSON object. It is a wrapper: the message names the field, and the cause carries the real conversion failure (type mismatch, bad numeric/date literal, variant/bytes failure, etc.). Fixing it means fixing the nested cause for the named field.","triggerScenarios":"Any field-level conversion error inside a ROW: a JSON string where a number is expected, an invalid TIMESTAMP/DATE format, a failed VARIANT or BINARY conversion (see 1400/1401), a DECIMAL with more digits than precision, etc. The wrapped converters run per record, so this appears at runtime on the offending message.","commonSituations":"Upstream schema drift (a field flips from number to string); malformed date/timestamp strings; nulls represented as \"\" instead of JSON null; precision/scale mismatches on DECIMAL columns.","solutions":["Read the cause chain of the JsonParseException to identify the underlying failure for the named field","Check the field's JSON value in the failing record against the declared Flink type and correct the DDL or the data","For date/time fields, verify the value matches the ISO-8601 formats Flink expects (or configure a custom format if supported by the pipeline)","If bad records are expected and skippable, set the format's ignore-parse-errors option where available (Canal/Debezium variants) or filter/quarantine upstream"],"exampleFix":"// before: JSON {\"ts\": \"2024-13-45 99:00:00\"} against TIMESTAMP(3)\n// after: fix upstream to emit \"2024-01-05 10:00:00\" or declare the column STRING and parse leniently in a UDF","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"catch (JsonParseException e) — read getFieldName from message and unwrap getCause(); fix the inner conversion (type mismatch / format) rather than retrying the same record.","preventionTips":["Contract-test the declared ROW schema against representative records","Watch for schema drift alerts from upstream","Use ignore-parse-errors only with monitoring of skipped counts"],"tags":["json","row","field-conversion","runtime","schema-drift"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}