apache/iceberg · error · UnsupportedOperationException
Unsupported type ID:
Error message
Unsupported type ID:
What it means
TypeToSchema converts Iceberg primitive types into Avro schemas; when it encounters a primitive type ID it has no Avro mapping for, it throws this UnsupportedOperationException. All standard Iceberg primitive types are handled, so this indicates a type outside the known set.
Source
Thrown at core/src/main/java/org/apache/iceberg/avro/TypeToSchema.java:281
break;
case BINARY:
case GEOMETRY:
case GEOGRAPHY:
primitiveSchema = BINARY_SCHEMA;
break;
case DECIMAL:
Types.DecimalType decimal = (Types.DecimalType) primitive;
primitiveSchema =
LogicalTypes.decimal(decimal.precision(), decimal.scale())
.addToSchema(
Schema.createFixed(
"decimal_" + decimal.precision() + "_" + decimal.scale(),
null,
null,
TypeUtil.decimalRequiredBytes(decimal.precision())));
break;
default:
throw new UnsupportedOperationException("Unsupported type ID: " + primitive.typeId());
}
cacheSchema(primitive, primitiveSchema);
return primitiveSchema;
}
static class WithTypeToName extends TypeToSchema {
private final Map<Type, Schema> results = Maps.newHashMap();
WithTypeToName(Map<Types.StructType, String> names) {
super((id, struct) -> names.get(struct));
}
Map<Type, Schema> getConversionMap() {
return results;
}View on GitHub (pinned to 86d9c8fc54)
Solutions
- Upgrade the Iceberg runtime to a version that supports the type ID in question
- Check the type passed in for accidental custom/wrapper types; use the canonical Iceberg Types.* primitives
- Rebuild dependent code against the same Iceberg version used to write the metadata
Example fix
// before Type t = myCustomWrapperType(); Schema s = AvroSchemaUtil.convert(t, "root"); // after Type t = Types.StringType.get(); Schema s = AvroSchemaUtil.convert(t, "root");
Defensive patterns
Strategy: validation
Validate before calling
if (!(type instanceof Types.StringType || type instanceof Types.LongType || /* all supported primitives */ type instanceof Types.IntegerType)) { throw new IllegalStateException("unsupported primitive: " + type); } Type guard
boolean isSupportedPrimitive(Type t) { return t.isPrimitiveType() && t.typeId() != Type.TypeID.UNKNOWN; } Try / catch
try { Schema s = AvroSchemaUtil.convert(type, "root"); } catch (UnsupportedOperationException e) { if (e.getMessage().startsWith("Unsupported type ID")) { /* align Iceberg versions */ } else throw e; } Prevention
- Keep producer and consumer Iceberg versions aligned
- Only use canonical Types.* primitives
- Check release notes when a new spec adds types
When it happens
Trigger: Calling TypeToSchema (or AvroSchemaUtil.convert on an Iceberg Type) with a Type whose typeId() is unknown to this version, e.g. types added in a newer Iceberg spec or custom Type implementations.
Common situations: Version mismatch: newer table metadata or catalog returning newer types consumed by an older Iceberg runtime; wrapping custom types via TypeUtil.
Related errors
- Unsupported to derive Schema for type: <logicalType>
- Unsupported type: variant
- Unsupported type:
- Unknown logical type:
- Unsupported type:
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/f2a525ea33572ecb.
Report an issue: GitHub.