apache/beam · error · IllegalArgumentException

Unsupported schema type

Error message

Unsupported schema type: {}

What it means

beamTypeFromJsonSchemaType converts a JSON Schema node into a Beam Schema.FieldType. When the JSON Schema property's type does not map to any supported Beam type (array, object, map, enum, string, number, integer, boolean, null), it throws this IllegalArgumentException listing the property's Java class. JSON-schema tuple-like arrays (prefixItems/positional arrays) are explicitly unsupported, which is also called out in the surrounding code.

Solutions

  1. Inspect the offending property schema (the class name is in the message) and rewrite it to a simple typed JSON Schema (type: object/array/string/number/integer/boolean) or a map-like object with additionalProperties.
  2. Replace tuple-like arrays (items as an array) with a uniform items schema (single object schema for all elements).
  3. Flatten anyOf/oneOf/allOf compositions or $ref references into concrete object schemas before passing to JsonUtils.
  4. If the type is legitimately unsupported, wrap the value as a STRING field and parse it downstream, or upgrade Beam to a version supporting more JSON Schema constructs.

Example fix

// before
{"type": "object", "properties": {"point": {"type": "array", "items": [{"type": "number"}, {"type": "number"}]}}}
// after
{"type": "object", "properties": {"point": {"type": "array", "items": {"type": "number"}}}}
Defensive patterns

Strategy: validation

Validate before calling

JSONObject parsed = new JSONObject(jsonSchema);
for (String key : parsed.getJSONObject("properties").keySet()) {
  Object prop = parsed.getJSONObject("properties").get(key);
  String type = prop instanceof JSONObject ? ((JSONObject) prop).optString("type", "") : "";
  if (type.isEmpty() || "anyOf".equals(type) || "oneOf".equals(type)
      || ("array".equals(type) && ((JSONObject) prop).opt("items") instanceof org.json.JSONArray)) {
    throw new IllegalArgumentException("Property '" + key + "' uses a JSON Schema construct unsupported by Beam: " + prop);
  }
}

Try / catch

try {
  Schema beamSchema = JsonUtils.jsonSchema(jsonSchemaString);
} catch (IllegalArgumentException e) {
  if (e.getMessage().startsWith("Unsupported schema type")) {
    // fall back to a string-encoded payload field or reject the schema upstream
  } else throw e;
}

Prevention

When it happens

Trigger: Calling JsonUtils.jsonToRow / jsonSchema with a JSON Schema whose property type resolves to a class not handled by the switch, e.g. a tuple-like array schema (items as an array), a combined schema (anyOf/oneOf/allOf/not), a reference schema, or a schema whose 'type' keyword is absent so the loaded schema is a bare Schema rather than a typed one.

Common situations: Feeding JSON Schema drafts that use 'items': [ ... ] positional arrays (draft-04 tuple validation), using $ref or anyOf composition for fields, or omitting the 'type' keyword on a property so the loader produces a non-typed schema node.

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/0eb02c08a2ea6d70. Report an issue: GitHub.

Appendix: source

Thrown at sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/utils/JsonUtils.java:306

      return ((NumberSchema) propertySchema).requiresInteger()
          ? Schema.FieldType.INT64
          : Schema.FieldType.DOUBLE;
    } else if (propertySchema instanceof org.everit.json.schema.StringSchema) {
      return Schema.FieldType.STRING;
    } else if (propertySchema instanceof org.everit.json.schema.ReferenceSchema) {
      org.everit.json.schema.Schema sch = ((ReferenceSchema) propertySchema).getReferredSchema();
      return beamTypeFromJsonSchemaType(sch);
    } else if (propertySchema instanceof org.everit.json.schema.ArraySchema) {
      if (((ArraySchema) propertySchema).getAllItemSchema() == null) {
        throw new IllegalArgumentException(
            "Array schema is not properly formatted or unsupported ("
                + propertySchema
                + "). Note that JSON-schema's tuple-like arrays are not supported by Beam.");
      }
      return Schema.FieldType.array(
          beamTypeFromJsonSchemaType(((ArraySchema) propertySchema).getAllItemSchema()));
    } else {
      throw new IllegalArgumentException("Unsupported schema type: " + propertySchema.getClass());
    }
  }

  private static org.everit.json.schema.ObjectSchema jsonSchemaFromString(String jsonSchema) {
    JSONObject parsedSchema = new JSONObject(jsonSchema);
    org.everit.json.schema.Schema schemaValidator =
        org.everit.json.schema.loader.SchemaLoader.load(parsedSchema);
    if (!(schemaValidator instanceof ObjectSchema)) {
      throw new IllegalArgumentException(
          String.format("The schema is not a valid object schema:%n %s", jsonSchema));
    }
    return (org.everit.json.schema.ObjectSchema) schemaValidator;
  }

  private abstract static class JsonToRowFn<T> extends SimpleFunction<T, Row> {
    final RowJson.RowJsonDeserializer deserializer;
    final ObjectMapper objectMapper;

View on GitHub (pinned to 12126d8942)