apache/iceberg · error · java.lang.IllegalArgumentException
Unsupported type: %s
Error message
Unsupported type: %s
What it means
FlinkAvroWriter.primitive() throws UnsupportedOperationException 'Unsupported type: <primitive>' when the Iceberg primitive type's Avro representation has no writer branch in the switch. This is a terminal catch-all meaning the Iceberg type -> Avro writer mapping cannot handle this primitive (e.g. unexpected Avro schema/type combination produced for the Iceberg type).
Source
Thrown at flink/v2.1/flink/src/main/java/org/apache/iceberg/flink/data/FlinkAvroWriter.java:175
case SMALLINT:
return ValueWriters.shorts();
default:
return ValueWriters.ints();
}
case LONG:
return ValueWriters.longs();
case FLOAT:
return ValueWriters.floats();
case DOUBLE:
return ValueWriters.doubles();
case STRING:
return FlinkValueWriters.strings();
case FIXED:
return ValueWriters.fixed(primitive.getFixedSize());
case BYTES:
return ValueWriters.bytes();
default:
throw new IllegalArgumentException("Unsupported type: " + primitive);
}
}
}
}
View on GitHub (pinned to 86d9c8fc54)
Solutions
- Check the table schema for the offending primitive type from the message.
- Upgrade iceberg-flink to a version supporting the type.
- Avoid writing the type through the Flink Avro path (e.g. use Parquet/ORC file format via table write.format.default).
- Reproject/drop the unsupported column before rewriting data files.
Example fix
// before
write.format.default=avro // column type unsupported by Avro writer
// after
ALTER TABLE t SET TBLPROPERTIES ('write.format.default'='parquet'); Defensive patterns
Strategy: validation
Validate before calling
schema.asStruct().fields().forEach(f -> {
Preconditions.checkArgument(supportedTypeIds.contains(f.type().typeId()),
"Type %s not supported by Flink Avro writer", f.type());
}); Type guard
boolean avroWritable(Type.TypeID id) {
switch (id) {
case BOOLEAN: case INTEGER: case LONG: case FLOAT: case DOUBLE:
case STRING: case BINARY: case FIXED: case DATE:
case TIMESTAMP: case DECIMAL:
return true;
default:
return false;
}
} Try / catch
try {
writer.write(row);
} catch (UnsupportedOperationException e) {
LOG.error("Avro writer cannot handle: {}", e.getMessage());
throw e;
} Prevention
- Use write.format.default=parquet for uncommon types.
- Validate table schema against supported Avro types before writing.
- Keep iceberg-flink up to date.
When it happens
Trigger: Building an Avro ValueWriter for an Iceberg primitive whose resolved Avro primitive type is not one of the handled cases (NULL, BOOLEAN, INT, LONG, FLOAT, DOUBLE, STRING, FIXED, BYTES, decimal/uuid logicals).
Common situations: Writing tables with exotic or newly added Iceberg primitive types via the Flink Avro writer; internal type resolution producing unexpected Avro types.
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: ${primitive}
- Unsupported Avro type '${schema.getType()}'.
- Unsupported to derive Schema for type: <logicalType>
- Avro format doesn't support non-string as key type of map. T
- Unsupported logical type: %s
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/aa76cd1eb042d6d5.
Report an issue: GitHub.