{"record":{"id":"3690c4f1570803c4","repo":"apache/beam","slug":"non-nullable-field-name-has-value-null-in-the-json-object","errorCode":null,"errorMessage":"Non-nullable field '{name}' has value null in the JSON object.","messagePattern":"Non-nullable field '(.+?)' has value null in the JSON object\\.","errorType":"validation","errorClass":"UnsupportedRowJsonException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/util/RowJson.java","lineNumber":306,"sourceCode":"        }\n\n        if (fieldValue.isJsonNull()) {\n          switch (this.nullBehavior) {\n            case ACCEPT_MISSING_OR_NULL:\n            case REQUIRE_NULL:\n              return null;\n            case REQUIRE_MISSING:\n              throw new UnsupportedRowJsonException(\n                  \"Field '\" + fieldValue.name() + \"' has a null value in the JSON object.\");\n          }\n        }\n      } else {\n        // field is not nullable\n        if (!fieldValue.isJsonValuePresent()) {\n          throw new UnsupportedRowJsonException(\n              \"Non-nullable field '\" + fieldValue.name() + \"' is not present in the JSON object.\");\n        } else if (fieldValue.isJsonNull()) {\n          throw new UnsupportedRowJsonException(\n              \"Non-nullable field '\" + fieldValue.name() + \"' has value null in the JSON object.\");\n        }\n      }\n\n      if (fieldValue.isRowType()) {\n        return jsonObjectToRow(fieldValue);\n      }\n\n      if (fieldValue.isArrayType()) {\n        return jsonArrayToList(fieldValue);\n      }\n\n      if (fieldValue.isMapType()) {\n        return jsonObjectToMap(fieldValue);\n      }\n\n      if (fieldValue.typeName().isLogicalType()) {\n        String identifier = fieldValue.type().getLogicalType().getIdentifier();","sourceCodeStart":288,"sourceCodeEnd":324,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/util/RowJson.java#L288-L324","documentation":"RowJson's deserializer rejects JSON null values for schema fields declared non-nullable. Beam Rows enforce nullability per field, so a JSON null mapped to a non-nullable field violates the schema and throws UnsupportedRowJsonException.","triggerScenarios":"jsonToRow / objectMapper.readValue with a JSON object that explicitly contains \"field\": null for a field marked non-nullable in the Row schema.","commonSituations":"Nullable-JSON APIs returning nulls for missing data; schema changed a field from nullable to non-nullable after producers were written; generic JSON-to-Row pipelines ingesting arbitrary payloads.","solutions":["Ensure producers emit real values instead of null for non-nullable fields","Make the field nullable in the schema if nulls are legitimate","Filter or default out null values in a pre-processing step before jsonToRow","Catch UnsupportedRowJsonException and route the record to an error path"],"exampleFix":"// before\n{\"id\": null}\n// after: make schema field nullable, or supply a value\n{\"id\": \"abc\"}","handlingStrategy":"validation","validationCode":"for (Schema.Field f : schema.getFields()) {\n  if (!f.getType().getNullable() && json.has(f.getName()) && json.get(f.getName()).isNull()) {\n    throw new IllegalArgumentException(\"Null value for non-nullable field: \" + f.getName());\n  }\n}","typeGuard":null,"tryCatchPattern":"try { Row r = RowJsonUtils.jsonToRow(mapper, json); } catch (RowJson.UnsupportedRowJsonException e) { /* log + dead-letter */ }","preventionTips":["Coerce nulls to defaults or drop records upstream","Declare fields nullable when the source can emit nulls","Contract-test producers against the reader schema"],"tags":["beam","json","schema","nullability"],"backgroundTag":"schema-validation-failed","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}