{"record":{"id":"3819cbc6bf9dcf14","repo":"apache/flink","slug":"could-not-find-field-with-name-s","errorCode":null,"errorMessage":"Could not find field with name '%s'.","messagePattern":"Could not find field with name '(.+?)'\\.","errorType":"exception","errorClass":"JsonParseException","httpStatus":null,"severity":"error","filePath":"flink-formats/flink-json/src/main/java/org/apache/flink/formats/json/JsonToRowDataConverters.java","lineNumber":377,"sourceCode":"                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        }\n    }\n\n    private JsonToRowDataConverter wrapIntoNullableConverter(JsonToRowDataConverter converter) {\n        return jsonNode -> {\n            if (jsonNode == null || jsonNode.isNull() || jsonNode.isMissingNode()) {\n                return null;\n            }\n            try {\n                return converter.convert(jsonNode);\n            } catch (Throwable t) {\n                if (!ignoreParseErrors) {\n                    throw t;","sourceCodeStart":359,"sourceCodeEnd":395,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-formats/flink-json/src/main/java/org/apache/flink/formats/json/JsonToRowDataConverters.java#L359-L395","documentation":"Thrown by JsonToRowDataConverters.convertField when a field declared in the ROW schema is absent from an incoming JSON object and the failOnMissingField flag is true. With the flag false (the default) a missing field simply becomes null. The flag maps to the table option 'json.fail-on-missing-field'.","triggerScenarios":"DDL/table option 'json.fail-on-missing-field' = 'true' while the consumed JSON message does not contain one or more declared columns. Triggered per record by JsonRowDataDeserializationSchema whenever node.get(fieldName) returns null.","commonSituations":"Schema declared with more columns than the producer emits; upstream schema evolution dropping a field; enabling fail-on-missing-field defensively and then feeding historical/sparse records; mixing producers with different record shapes into one topic.","solutions":["Set 'json.fail-on-missing-field' = 'false' (default) so absent fields deserialize to null","Ensure the producer includes all declared fields, or align the DDL to the actual JSON payload","If both strict and lenient consumers are needed, split the topic or preprocess records to fill defaults before ingestion"],"exampleFix":"// before\nWITH ('connector'='kafka', 'format'='json', 'json.fail-on-missing-field'='true')\n\n// after\nWITH ('connector'='kafka', 'format'='json', 'json.fail-on-missing-field'='false')","handlingStrategy":"validation","validationCode":"// If unsure the producer always emits all fields, do not enable strict mode:\n// 'json.fail-on-missing-field' defaults to false; leave it false and null-check downstream\nif (row.getField(i) == null) { /* handle absent column explicitly */ }","typeGuard":null,"tryCatchPattern":"catch (JsonParseException e) on 'Could not find field' — either disable fail-on-missing-field or fix the producer; retrying cannot help.","preventionTips":["Default 'json.fail-on-missing-field' to false","Only enable strict mode after verifying producer completeness on a sample","Handle nulls downstream explicitly"],"tags":["json","missing-field","schema","option","runtime"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}