apache/beam · error · IllegalArgumentException

Unsupported field type {} in field {}

Error message

Unsupported field type {} in field {}

What it means

In JsonUtils.addPropertySchemaToBeamSchema, when a JSON Schema property is not an array/object/reference type, the code tries to map it with beamTypeFromJsonSchemaType; if that mapping throws IllegalArgumentException, this wrapper is thrown naming the property's Java class and field name. It means the JSON Schema property uses a type Beam cannot translate.

Source

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

      if (((ArraySchema) propertySchema).getAllItemSchema() == null) {
        throw new IllegalArgumentException(
            "Tuple-like arrays are unsupported. Expected a single item type for field "
                + propertyName);
      }
      beamSchemaBuilder =
          beamSchemaBuilder.addField(
              fieldConstructor.apply(
                  propertyName,
                  Schema.FieldType.array(
                      beamTypeFromJsonSchemaType(
                          ((ArraySchema) propertySchema).getAllItemSchema()))));
    } else {
      try {
        beamSchemaBuilder =
            beamSchemaBuilder.addField(
                fieldConstructor.apply(propertyName, beamTypeFromJsonSchemaType(propertySchema)));
      } catch (IllegalArgumentException e) {
        throw new IllegalArgumentException(
            "Unsupported field type " + propertySchema.getClass() + " in field " + propertyName, e);
      }
    }
    return beamSchemaBuilder;
  }

  private static Schema.FieldType beamTypeFromJsonSchemaType(
      org.everit.json.schema.Schema propertySchema) {
    if (propertySchema instanceof org.everit.json.schema.ObjectSchema) {
      return Schema.FieldType.row(beamSchemaFromJsonSchema((ObjectSchema) propertySchema));
    } else if (propertySchema instanceof org.everit.json.schema.BooleanSchema) {
      return Schema.FieldType.BOOLEAN;
    } else if (propertySchema instanceof org.everit.json.schema.NumberSchema) {
      return ((NumberSchema) propertySchema).requiresInteger()
          ? Schema.FieldType.INT64
          : Schema.FieldType.DOUBLE;
    } else if (propertySchema instanceof org.everit.json.schema.StringSchema) {
      return Schema.FieldType.STRING;

View on GitHub (pinned to 12126d8942)

Solutions

  1. Simplify the property's JSON Schema to a single plain type (string/number/boolean/object/array) or a $ref
  2. Unwrap anyOf/oneOf into a concrete type before passing to Beam
  3. Extend beamTypeFromJsonSchemaType to handle the unsupported schema class
  4. Inspect the chained cause to see which inner type mapping failed

Example fix

// before
{"a":{"anyOf":[{"type":"string"},{"type":"integer"}]}}
// after
{"a":{"type":"string"}}
Defensive patterns

Strategy: validation

Validate before calling

static boolean isSimpleOrRefOrContainer(org.everit.json.schema.Schema s) {
  return s instanceof org.everit.json.schema.StringSchema
      || s instanceof org.everit.json.schema.NumberSchema
      || s instanceof org.everit.json.schema.BooleanSchema
      || s instanceof org.everit.json.schema.ObjectSchema
      || s instanceof org.everit.json.schema.ArraySchema
      || s instanceof org.everit.json.schema.ReferenceSchema;
}

Type guard

static boolean beamMappableProperty(org.everit.json.schema.Schema s) {
  return isSimpleOrRefOrContainer(s) && !(s instanceof org.everit.json.schema.CombinedSchema);
}

Try / catch

try {
  Schema s = JsonUtils.beamSchemaFromJsonSchema(jsonSchema);
} catch (IllegalArgumentException e) {
  if (e.getCause() instanceof IllegalArgumentException) {
    throw new SchemaParseException("Unsupported field type: " + e.getCause().getMessage(), e);
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling JsonUtils.fromJsonSchema/beamSchemaFromJsonSchema with a property whose schema class is unsupported (e.g. CombinedSchema, NotSchema, or an exotic everit schema type) instead of simple types, references, arrays, or object schemas.

Common situations: JSON Schemas using anyOf/oneOf/allOf combined constraints on a field; $ref plus inline constraints producing CombinedSchema; enums or format-only schemas the mapper doesn't recognize.

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/33f452102111b6f7. Report an issue: GitHub.