apache/iceberg · error · IllegalArgumentException
Unsupported type:
Error message
Unsupported type:
What it means
PlannedDataReader.primitive() switches over Avro primitive types and throws this IllegalArgumentException in the default branch when the read schema contains a primitive type with no mapping (e.g. an unhandled type such as a record-level mismatch or an exotic primitive). It's the read-side counterpart of DataWriter's unsupported-type error.
Source
Thrown at core/src/main/java/org/apache/iceberg/data/avro/PlannedDataReader.java:203
return ValueReaders.ints();
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:
// might want to use a binary-backed container like Utf8
return ValueReaders.strings();
case FIXED:
return ValueReaders.fixed(primitive.getFixedSize());
case BYTES:
return ValueReaders.byteBuffers();
default:
throw new IllegalArgumentException("Unsupported type: " + primitive);
}
}
}
}
View on GitHub (pinned to 86d9c8fc54)
Solutions
- Identify the unsupported primitive from the message and align the read schema with supported types.
- Upgrade Iceberg so PlannedDataReader supports the type.
- Project the schema to exclude the unsupported field before reading.
- Add a ValueReaders mapping case if the type should be supported.
Example fix
// before
reader.read(schemaWithUnsupportedPrimitive, decoder); // throws
// after
Schema projected = schema.select("supportedField");
reader.read(projected, decoder); Defensive patterns
Strategy: validation
Validate before calling
for (Schema.Field f : schema.getFields()) {
Schema.Type t = f.schema().getType();
if (!Set.of("NULL","BOOLEAN","INT","LONG","FLOAT","DOUBLE","STRING","FIXED","BYTES", "RECORD","ARRAY","MAP","UNION").contains(t.name())) {
throw new IllegalArgumentException("Unsupported primitive: " + t);
}
} Type guard
null
Try / catch
try { return reader.read(schema, decoder); } catch (IllegalArgumentException e) { if (e.getMessage().startsWith("Unsupported type")) { return reader.read(projectSupported(schema), decoder); } throw e; } Prevention
- Match reader library version to writer version
- Project out unsupported fields before reading
- Round-trip test schemas in CI
When it happens
Trigger: Calling PlannedDataReader.read on a schema whose primitive branch falls through the switch — the schema's primitive type is not one of NULL/BOOLEAN/INT/LONG/FLOAT/DOUBLE/STRING/FIXED/BYTES handled above.
Common situations: Reading data written with newer Avro/Iceberg types by an older reader; corrupted or hand-built schemas; version skew between writer and reader libraries.
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
- Unsupported type: variant
- Unsupported type:
- Unknown logical type:
- Unsupported Avro type '${schema.getType()}'.
- Unsupported Avro type '${schema.getType()}'.
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/0d5c669975c28213.
Report an issue: GitHub.