{"record":{"id":"99bd724185fb6c49","repo":"apache/seatunnel","slug":"could-not-find-field-with-name-fieldname","errorCode":null,"errorMessage":"Could not find field with name ${fieldName} .","messagePattern":"Could not find field with name (.+?) \\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"seatunnel-formats/seatunnel-format-json/src/main/java/org/apache/seatunnel/format/json/JsonToRowConverters.java","lineNumber":504,"sourceCode":"                                            throw CommonError.jsonOperationError(\n                                                    FORMAT, entry.getKey(), e);\n                                        }\n                                        value.put(\n                                                keyConverter.convert(keyNode, fieldName + \".key\"),\n                                                valueConverter.convert(\n                                                        entry.getValue(), fieldName + \".value\"));\n                                    }\n                                });\n                return value;\n            }\n        };\n    }\n\n    private Object convertField(\n            JsonToObjectConverter fieldConverter, String fieldName, JsonNode field) {\n        if (field == null) {\n            if (failOnMissingField) {\n                throw new IllegalArgumentException(\n                        String.format(\"Could not find field with name %s .\", fieldName));\n            } else {\n                return null;\n            }\n        } else {\n            return fieldConverter.convert(field, fieldName);\n        }\n    }\n\n    private JsonToObjectConverter wrapIntoNullableConverter(JsonToObjectConverter converter) {\n        return new JsonToObjectConverter() {\n            @Override\n            public Object convert(JsonNode jsonNode, String fieldName) {\n                if (jsonNode == null || jsonNode.isNull() || jsonNode.isMissingNode()) {\n                    return null;\n                }\n                try {\n                    return converter.convert(jsonNode, fieldName);","sourceCodeStart":486,"sourceCodeEnd":522,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-formats/seatunnel-format-json/src/main/java/org/apache/seatunnel/format/json/JsonToRowConverters.java#L486-L522","documentation":"Thrown by JsonToRowConverters.convertField when a JSON node does not contain the requested field and failOnMissingField is true. The format validates strictly so that missing JSON fields surface loudly instead of silently producing null rows. If failOnMissingField is false, it returns null instead of throwing.","triggerScenarios":"Deserializing a JSON payload whose object lacks a key the configured SeaTunnelRowType expects, with failOnMultiFields/failOnMissingField enabled; convertField receives a null field node from convertedField lookup.","commonSituations":"Upstream producers changed their JSON schema (renamed or dropped a key); optional fields absent in some messages; parsing CDC/debezium-like payloads where nested fields vary per event; row type declared in SeaTunnel config is stricter than the actual data.","solutions":["Add the missing field to the incoming JSON payload or fix the key name to match the declared row type","Set json.fail-on-missing-field=false (JsonParseOptions.FAIL_ON_MISSING_FIELD) so missing fields deserialize as null","Align the SeaTunnelRowType schema in the config with the actual JSON structure (remove or rename fields)","Pre-validate sample payloads against the configured schema before running the job"],"exampleFix":"// before (config)\njson {\n  fail-on-missing-field = true\n}\n// after\njson {\n  fail-on-missing-field = false\n  ignore-parse-errors = true\n}","handlingStrategy":"validation","validationCode":"// Java: verify payload keys against row type before deserializing\nfor (String field : rowType.getFieldNames()) {\n    if (!jsonNode.has(field)) {\n        throw new IllegalStateException(\"Missing field: \" + field);\n    }\n}","typeGuard":"if (jsonNode != null && jsonNode.isObject() && jsonNode.has(fieldName)) { /* safe to convert */ }","tryCatchPattern":"try { row = converter.convert(jsonNode); } catch (IllegalArgumentException e) { if (e.getMessage().contains(\"Could not find field\")) { /* handle missing field */ } else { throw e; } }","preventionTips":["Set fail-on-missing-field=false when JSON fields are optional or variable","Keep the declared SeaTunnelRowType in sync with actual producer schema","Write a contract test comparing sample payloads to the configured row type","Pin producer schema versions when upstream teams evolve payloads"],"tags":["json","deserialization","schema","missing-field"],"backgroundTag":"schema-validation-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}