apache/iceberg · error · java.lang.IllegalArgumentException

Unsupported type:

Error message

Unsupported type: 

What it means

The same ReadBuilder.primitive(...) maps Avro primitive schema types (STRING, INT, LONG, FLOAT, DOUBLE, BOOLEAN, FIXED, BYTES, ENUM, NULL) to value readers; any remaining Avro type reaches the default branch and throws IllegalArgumentException naming the schema. Since primitive(...) only receives Avro primitives, this guards against unhandled primitives.

Source

Thrown at flink/v2.3/flink/src/main/java/org/apache/iceberg/flink/data/FlinkPlannedAvroReader.java:198

        case LONG:
          return ValueReaders.longs();
        case FLOAT:
          if (partner != null && partner.typeId() == Type.TypeID.DOUBLE) {
            return ValueReaders.floatsAsDoubles();
          }
          return ValueReaders.floats();
        case DOUBLE:
          return ValueReaders.doubles();
        case STRING:
          return FlinkValueReaders.strings();
        case FIXED:
          return ValueReaders.fixed(primitive.getFixedSize());
        case BYTES:
          return ValueReaders.bytes();
        case ENUM:
          return FlinkValueReaders.enums(primitive.getEnumSymbols());
        default:
          throw new IllegalArgumentException("Unsupported type: " + primitive);
      }
    }
  }
}

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Check the Avro schema in the error message and align the reader library version with the data producer.
  2. Rewrite the data using standard Avro primitive types covered by the reader.
  3. If a legitimate type is missing, add a case to the switch in ReadBuilder.primitive and upstream the patch.

Example fix

// before: field typed with an unknown primitive variant
// after: use standard {"type":"bytes"} or another supported Avro primitive
Defensive patterns

Strategy: validation

Validate before calling

// java
switch (schema.getType()) {
  case RECORD: case ENUM: case ARRAY: case MAP: case UNION: case FIXED: case STRING:
  case BYTES: case INT: case LONG: case FLOAT: case DOUBLE: case BOOLEAN: case NULL:
    break; // supported surface
  default:
    throw new IllegalArgumentException("Unexpected Avro schema type: " + schema.getType());
}

Try / catch

// java
try {
  reader = FlinkPlannedAvroReader.create(schema);
} catch (IllegalArgumentException e) {
  // inspect schema, upgrade runtime or rewrite data
}

Prevention

When it happens

Trigger: Encountering an Avro primitive type not covered by the switch — practically, this is a defensive path hit when a new/unknown Avro primitive appears or when the builder is fed a schema type it never expected.

Common situations: Version skew between the Iceberg Flink runtime and the library that produced the Avro schema; custom Avro extensions adding primitive-like types; internal misuse passing a non-primitive schema shape into primitive(...).

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12). Data as JSON: /api/errors/ac8a2f321b2951e4. Report an issue: GitHub.