apache/iceberg · error · java.lang.UnsupportedOperationException
Cannot convert unknown type to Flink:
Error message
Cannot convert unknown type to Flink:
What it means
TypeToFlinkType.toFlinkType's primitive() branch hit an Iceberg primitive type it has no Flink logical-type mapping for, so it throws UnsupportedOperationException. This guards against silent mis-typed schemas when bridging Iceberg to Flink types.
Source
Thrown at flink/v2.3/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 whose TypeToFlinkType supports the type.
- Inspect the table schema and remove/replace the unsupported primitive type.
- If a newly supported type is missing, patch the switch to add a mapping.
Defensive patterns
Strategy: try-catch
Validate before calling
if (type.isPrimitiveType() && !SUPPORTED.contains(type.asPrimitiveType().typeId())) {
throw new IllegalArgumentException("Unsupported Iceberg type for Flink: " + type);
} Try / catch
try { flinkType = TypeToFlinkType.toFlinkType(type); } catch (UnsupportedOperationException e) { /* handle unsupported type */ } Prevention
- Keep iceberg-flink runtime version aligned with the writer of the table metadata.
- Validate table schemas against known-supported primitives before planning.
- Avoid hand-constructing Type objects outside the public builders.
When it happens
Trigger: Converting an Iceberg schema containing a primitive type not covered by the switch (e.g. very new/unknown primitive added by a newer Iceberg version, or a null/invalid type reaching the converter).
Common situations: Version skew: table written by newer Iceberg with types this Flink build's converter doesn't know; programmatically constructed malformed Type objects.
Understand the failure class
Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.
Related errors
- Cannot convert unknown type to Flink: ${primitive}
- 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/2d1bda3397e26814.
Report an issue: GitHub.