apache/beam · error · UnsupportedRowJsonException
Field '{name}' has a null value in the JSON object.
Error message
Field '{name}' has a null value in the JSON object. What it means
RowJson's extractor throws UnsupportedRowJsonException when nullBehavior is REQUIRE_MISSING but the field is present with an explicit JSON null value. This enforces the opposite strictness of error 708: nulls must be represented by absence, not by JSON null. Raised in extractJsonNodeValue during deserialization.
Source
Thrown at sdks/java/core/src/main/java/org/apache/beam/sdk/util/RowJson.java:296
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(
"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);
}
View on GitHub (pinned to 12126d8942)
Solutions
- Use ACCEPT_MISSING_OR_NULL nullBehavior to accept both absent keys and JSON nulls.
- Change the producer to omit the key instead of writing null.
- Pre-process JSON to drop null-valued keys before deserialization.
Example fix
// before
{"user": null} // with nullBehavior(REQUIRE_MISSING) -> throws
// after
{} // omit the key, or switch to ACCEPT_MISSING_OR_NULL Defensive patterns
Strategy: try-catch
Validate before calling
Iterator<Map.Entry<String, JsonNode>> it = json.fields();
while (it.hasNext()) {
if (it.next().getValue().isNull()) it.remove(); // drop explicit nulls before convert
} Try / catch
try {
Row row = jsonToRow.convert(json);
} catch (UnsupportedRowJsonException e) {
LOG.warn("Unexpected JSON null: {}", e.getMessage());
row = convertWithLenientNullBehavior(json); // ACCEPT_MISSING_OR_NULL
} Prevention
- Don't use REQUIRE_MISSING with producers that serialize nulls as JSON null.
- Strip null-valued keys before deserialization or use ACCEPT_MISSING_OR_NULL.
- Align null conventions (absence vs explicit null) between producer and consumer.
- Cover null-field fixtures in deserialization tests.
When it happens
Trigger: Deserializing JSON containing {"field": null} while RowJson is configured with nullBehavior=REQUIRE_MISSING for that field.
Common situations: Producers that serialize Java nulls as JSON null instead of omitting keys; mismatch between the chosen strict null policy and the producer's convention; hand-written test fixtures using null.
Related errors
- Field '{name}' is not present in the JSON object.
- Unable to parse representation
- Found incorrectly annotated property methods, if a method is
- Unable to parse JSON value
- Error deserializing via Coder
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/dcd7ab0a04d13603.
Report an issue: GitHub.