apache/beam · error · UnsupportedRowJsonException

Unable to get value from field '{name}'. Schema type '{typeN

Error message

Unable to get value from field '{name}'. Schema type '{typeName}'. JSON node type {jsonNodeType}

What it means

extractJsonPrimitiveValue looks up a per-type value getter by the field's schema type name and applies it to the Jackson node. Any RuntimeException from that getter (e.g. asking for TEXT and getting a number node, or numeric overflow, or bad logical-type formats) is rethrown as UnsupportedRowJsonException describing the schema type and JSON node type.

Source

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

        Map.Entry<String, JsonNode> field = fields.next();
        String key = field.getKey();
        JsonNode value = field.getValue();

        Object extractedValue =
            extractJsonNodeValue(
                FieldValue.of(
                    mapFieldValue.name() + "['" + key + "']", mapFieldValue.mapValueType(), value));

        result.put(key, extractedValue);
      }
      return result;
    }

    private static Object extractJsonPrimitiveValue(FieldValue fieldValue) {
      try {
        return JSON_VALUE_GETTERS.get(fieldValue.typeName()).extractValue(fieldValue.jsonValue());
      } catch (RuntimeException e) {
        throw new UnsupportedRowJsonException(
            "Unable to get value from field '"
                + fieldValue.name()
                + "'. Schema type '"
                + fieldValue.typeName()
                + "'. JSON node type "
                + fieldValue.jsonNodeType().name(),
            e);
      }
    }

    /**
     * Helper class to keep track of schema field type, name, and actual json value for the field.
     */
    @AutoValue
    abstract static class FieldValue {
      abstract String name();

      abstract FieldType type();

View on GitHub (pinned to 12126d8942)

Solutions

  1. Align JSON value types with the schema field types (string for TEXT, integer for INT64, etc.)
  2. Fix logical-type formats (e.g. ISO-8601 datetimes) in the payload
  3. Pre-convert/coerce values before jsonToRow
  4. Catch UnsupportedRowJsonException; its message names the field, schema type, and JSON node type to pinpoint the mismatch

Example fix

// before: schema field INTEGER
{"count": "12"}
// after
{"count": 12}
Defensive patterns

Strategy: validation

Validate before calling

if (schemaField.getType().getTypeName() == Schema.TypeName.INT64 && node.isTextual()) {
  json.put(schemaField.getName(), Long.parseLong(node.asText())); // coerce before parse
}

Try / catch

try { Row r = RowJsonUtils.jsonToRow(mapper, json); } catch (RowJson.UnsupportedRowJsonException e) { /* message names field, schema type, json node type */ }

Prevention

When it happens

Trigger: jsonToRow where a leaf field's JSON value cannot be converted to the declared schema primitive/logical type, e.g. string node for INTEGER field, or invalid datetime string for a logical type.

Common situations: Type drift between producers and schema; locale/date formats not matching expected logical types; large numbers overflowing target types; unit-prefixed numbers passed as-is.

Understand the failure class

Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.

Related errors


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