apache/beam · error · UnsupportedRowJsonException

Non-nullable field '{name}' is not present in the JSON objec

Error message

Non-nullable field '{name}' is not present in the JSON object.

What it means

RowJson's Jackson deserializer builds Beam Rows from JSON. For a schema field declared non-nullable, the library requires the key to be present in the JSON object; if it is absent it throws UnsupportedRowJsonException. This enforces Beam Row's schema nullability contract at deserialization time.

Source

Thrown at sdks/java/core/src/main/java/org/apache/beam/sdk/util/RowJson.java:303

              throw new UnsupportedRowJsonException(
                  "Field '" + fieldValue.name() + "' is not present in the JSON object.");
          }
        }

        if (fieldValue.isJsonNull()) {
          switch (this.nullBehavior) {
            case ACCEPT_MISSING_OR_NULL:
            case REQUIRE_NULL:
              return null;
            case REQUIRE_MISSING:
              throw new UnsupportedRowJsonException(
                  "Field '" + fieldValue.name() + "' has a null value in the JSON object.");
          }
        }
      } else {
        // field is not nullable
        if (!fieldValue.isJsonValuePresent()) {
          throw new UnsupportedRowJsonException(
              "Non-nullable field '" + fieldValue.name() + "' is not present in the JSON object.");
        } else if (fieldValue.isJsonNull()) {
          throw new UnsupportedRowJsonException(
              "Non-nullable field '" + fieldValue.name() + "' has value null in the JSON object.");
        }
      }

      if (fieldValue.isRowType()) {
        return jsonObjectToRow(fieldValue);
      }

      if (fieldValue.isArrayType()) {
        return jsonArrayToList(fieldValue);
      }

      if (fieldValue.isMapType()) {
        return jsonObjectToMap(fieldValue);
      }

View on GitHub (pinned to 12126d8942)

Solutions

  1. Add the missing field to the JSON input so every non-nullable schema field has a key
  2. Make the schema field nullable via Schema.Field.nullable(...) if absence is acceptable
  3. Pre-process/normalize the JSON to fill defaults for missing keys before parsing
  4. Catch UnsupportedRowJsonException and skip/dead-letter the malformed record

Example fix

// before: schema has non-nullable field 'id'
{"name": "x"}
// after
{"id": "abc", "name": "x"}
Defensive patterns

Strategy: validation

Validate before calling

Set<String> present = json.fields().hasNext() ? new HashSet<>() : new HashSet<>();
json.fieldNames().forEachRemaining(present::add);
List<String> missing = schema.getFields().stream()
    .filter(f -> !f.getType().getNullable() && !present.contains(f.getName()))
    .map(Schema.Field::getName).collect(Collectors.toList());
if (!missing.isEmpty()) throw new IllegalArgumentException("Missing non-nullable fields: " + missing);

Try / catch

try { Row r = RowJsonUtils.jsonToRow(mapper, json); } catch (RowJson.UnsupportedRowJsonException e) { /* dead-letter e */ }

Prevention

When it happens

Trigger: Calling RowJsonUtils.jsonToRow (directly or via ObjectMapper.readValue with a RowJson.RowJsonCreator deserializer) with a JSON object that omits a key for a non-nullable field of the Row schema.

Common situations: Producer schema evolved and a required field was dropped; hand-written JSON fixtures missing fields; upstream APIs omit keys instead of emitting nulls; user assumed absent keys default to a zero value.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/9b2f80b588887d6f. Report an issue: GitHub.