apache/beam · error · UnsupportedRowJsonException

Field '{name}' is not present in the JSON object.

Error message

Field '{name}' is not present in the JSON object.

What it means

RowJson's field extractor throws UnsupportedRowJsonException when the nullBehavior is REQUIRE_NULL but the field is entirely absent from the JSON object (not even present as null). This enforces a strict contract that fields declared non-nullable in the schema must be explicitly present in the JSON. It is raised in extractJsonNodeValue during deserialization.

Source

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

    @Override
    public Row deserialize(JsonParser jsonParser, DeserializationContext deserializationContext)
        throws IOException {

      // Parse and convert the root object to Row as if it's a nested field with name 'root'
      return (Row)
          extractJsonNodeValue(
              FieldValue.of("root", FieldType.row(schema), jsonParser.readValueAsTree()));
    }

    private Object extractJsonNodeValue(FieldValue fieldValue) {
      if (fieldValue.type().getNullable()) {
        if (!fieldValue.isJsonValuePresent()) {
          switch (this.nullBehavior) {
            case ACCEPT_MISSING_OR_NULL:
            case REQUIRE_MISSING:
              return null;
            case REQUIRE_NULL:
              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(

View on GitHub (pinned to 12126d8942)

Solutions

  1. Switch RowJson nullBehavior to ACCEPT_MISSING_OR_NULL if missing fields are acceptable.
  2. Fix the producer to always emit the field, or emit null explicitly.
  3. Wrap the JSON with defaults before deserialization (set missing keys to null).

Example fix

// before
RowJson.JsonToRowConverter c = RowJson.JsonToRowConverter.forSchema(schema,
    RowJson.RowJsonBuilder... nullBehavior(REQUIRE_NULL));
// after
... nullBehavior(ACCEPT_MISSING_OR_NULL);
Defensive patterns

Strategy: try-catch

Validate before calling

ObjectNode copy = json.deepCopy();
schema.getFieldNames().forEach(n ->
    copy.withArray(n) /* ensure key exists, set null if missing */);
// or simply choose a lenient nullBehavior before converting

Try / catch

try {
  Row row = jsonToRow.convert(json);
} catch (UnsupportedRowJsonException e) {
  LOG.warn("Missing field in JSON: {}", e.getMessage());
  row = convertWithLenientNullBehavior(json); // ACCEPT_MISSING_OR_NULL
}

Prevention

When it happens

Trigger: Deserializing JSON with RowJson configured with nullBehavior=REQUIRE_NULL while a schema field is missing from the JSON object (isJsonValuePresent false).

Common situations: Producer omits optional keys; JSON schema evolved so older messages lack a new field; strict null behavior (REQUIRE_NULL/REQUIRE_MISSING) selected for lenient producers.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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