apache/iceberg · error · java.lang.UnsupportedOperationException
Cannot convert unknown type to Flink: %s
Error message
Cannot convert unknown type to Flink: %s
What it means
TypeToFlinkType.primitive maps Iceberg primitive Types to Flink DataTypes; an unrecognized primitive hits the default branch and throws this message with the type's toString. It means an Iceberg type reached the converter that this Iceberg-Flink version does not know how to map (often a newer type than the runtime supports).
Source
Thrown at flink/v2.1/flink/src/main/java/org/apache/iceberg/flink/TypeToFlinkType.java:148
} else {
// NANOS
return new TimestampType(9);
}
case STRING:
return new VarCharType(VarCharType.MAX_LENGTH);
case UUID:
// UUID length is 16
return new BinaryType(16);
case FIXED:
Types.FixedType fixedType = (Types.FixedType) primitive;
return new BinaryType(fixedType.length());
case BINARY:
return new VarBinaryType(VarBinaryType.MAX_LENGTH);
case DECIMAL:
Types.DecimalType decimal = (Types.DecimalType) primitive;
return new DecimalType(decimal.precision(), decimal.scale());
default:
throw new UnsupportedOperationException(
"Cannot convert unknown type to Flink: " + primitive);
}
}
}
View on GitHub (pinned to 86d9c8fc54)
Solutions
- Upgrade the iceberg-flink runtime to a version that maps the offending primitive type
- Migrate the column to a supported type (e.g. timestamp -> micros timestamp) with add/update-schema rewrite
- Check for mixed Iceberg jar versions on the classpath and align them
Example fix
// before Table column: timestamp_ns with old iceberg-flink runtime -> throws // after Upgrade iceberg-flink runtime, or rewrite column to Types.TimestampType (micros)
Defensive patterns
Strategy: validation
Validate before calling
for (Types.NestedField f : schema.columns()) {
if (f.type().isPrimitiveType()) {
Type.PrimitiveType p = f.type().asPrimitiveType();
// e.g. reject TimestampNanoType / unknown types before conversion
}
} Type guard
boolean isSupportedIcebergPrimitive(Type t) {
return switch (t.typeId()) {
case BOOLEAN, INT, LONG, FLOAT, DOUBLE, DATE, TIME, TIMESTAMP,
STRING, UUID, FIXED, BINARY, DECIMAL -> true;
default -> false;
};
} Try / catch
try {
DataType dt = TypeToFlinkType.toFlinkType(primitive);
} catch (UnsupportedOperationException e) {
throw new IllegalStateException("Upgrade iceberg-flink or migrate column: " + e.getMessage(), e);
} Prevention
- Align Iceberg runtime versions across writers and the Flink job
- Avoid nano-timestamp/new types until the runtime supports them
- Run schema compatibility checks in CI for cross-engine tables
When it happens
Trigger: Converting an Iceberg schema to Flink types where a column's primitive type is missing from the switch (e.g. Types.TimestampNanoType/unknown Variant on older runtimes) — via FlinkSchemaUtil.convert(schema) or table schema-to-Flink conversion at scan/sink setup.
Common situations: Iceberg tables written by newer engines with nano-timestamp or unknown future types being read by an older iceberg-flink runtime; mixed Iceberg versions on the classpath.
Understand the failure class
Background: "is not a compatible type" / "cannot merge" errors: when a value's type doesn't match what the library requires — this error's family across 65 libraries.
Related errors
- Unsupported YearMonthIntervalType.
- Unsupported DayTimeIntervalType.
- Unsupported DistinctType.
- Unsupported StructuredType.
- Unsupported type: %s
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/9ecd903bf3060399.
Report an issue: GitHub.