apache/iceberg · error · UnsupportedOperationException
Cannot convert unknown type to Flink: ${primitive}
Error message
Cannot convert unknown type to Flink: ${primitive} What it means
TypeToFlinkType maps an Iceberg primitive type to a Flink LogicalType. The switch over the primitive has no case for the given type, so conversion fails with UnsupportedOperationException. It indicates the Iceberg type is not representable in Flink by this converter (e.g. an unknown or newer-spec Iceberg type).
Source
Thrown at flink/v1.20/flink/src/main/java/org/apache/iceberg/flink/TypeToFlinkType.java:142
} 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
- Verify the table schema only contains Flink-supported Iceberg types
- Upgrade the iceberg-flink module to match the iceberg-core version that produced the schema
- Extend the converter explicitly if a new type must be supported
Example fix
// before
case UNKNOWN: // falls to default -> throws
// after
case VARIANT: case UNKNOWN:
throw new IllegalArgumentException("Type not supported by this Flink version: " + primitive); Defensive patterns
Strategy: validation
Validate before calling
for (Types.NestedField f : schema.columns()) { if (f.type().isPrimitiveType()) checkSupported(f.type().asPrimitiveType()); } Type guard
boolean supported(Type t) { return !(t instanceof Type.PrimitiveType) || SUPPORTED.contains(((Type.PrimitiveType) t).typeId()); } Try / catch
try { convert(schema); } catch (UnsupportedOperationException e) { LOG.error("Unsupported Iceberg type for Flink: {}", e.getMessage()); throw e; } Prevention
- Keep iceberg-flink and iceberg-core versions in sync
- Validate schemas against supported type sets at job startup
- Avoid hand-crafted Iceberg types in Flink jobs
When it happens
Trigger: Calling FlinkSchemaUtil.convert / TypeToFlinkType.primitive with an Iceberg type outside the supported set of primitives.
Common situations: Tables written with a newer Iceberg spec exposing types the pinned Flink integration does not know; version skew between iceberg-core and iceberg-flink modules; hand-built schemas with exotic types.
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
- Cannot convert unknown type to Flink:
- Invalid primary key '%s'. A primary key must not contain dup
- Invalid primary key '%s'. Column '%s' does not exist.
- Invalid primary key '%s'. Column '%s' is not a physical colu
- Invalid primary key '%s'. Column '%s' is nullable.
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/b8521dfa3ec50cab.
Report an issue: GitHub.