{"record":{"id":"b8521dfa3ec50cab","repo":"apache/iceberg","slug":"cannot-convert-unknown-type-to-flink-primitive","errorCode":null,"errorMessage":"Cannot convert unknown type to Flink: ${primitive}","messagePattern":"Cannot convert unknown type to Flink: (.+?)","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"flink/v1.20/flink/src/main/java/org/apache/iceberg/flink/TypeToFlinkType.java","lineNumber":142,"sourceCode":"        } else {\n          // NANOS\n          return new TimestampType(9);\n        }\n      case STRING:\n        return new VarCharType(VarCharType.MAX_LENGTH);\n      case UUID:\n        // UUID length is 16\n        return new BinaryType(16);\n      case FIXED:\n        Types.FixedType fixedType = (Types.FixedType) primitive;\n        return new BinaryType(fixedType.length());\n      case BINARY:\n        return new VarBinaryType(VarBinaryType.MAX_LENGTH);\n      case DECIMAL:\n        Types.DecimalType decimal = (Types.DecimalType) primitive;\n        return new DecimalType(decimal.precision(), decimal.scale());\n      default:\n        throw new UnsupportedOperationException(\n            \"Cannot convert unknown type to Flink: \" + primitive);\n    }\n  }\n}\n","sourceCodeStart":124,"sourceCodeEnd":147,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/flink/v1.20/flink/src/main/java/org/apache/iceberg/flink/TypeToFlinkType.java#L124-L147","documentation":"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).","triggerScenarios":"Calling FlinkSchemaUtil.convert / TypeToFlinkType.primitive with an Iceberg type outside the supported set of primitives.","commonSituations":"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.","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"],"exampleFix":"// before\ncase UNKNOWN: // falls to default -> throws\n// after\ncase VARIANT: case UNKNOWN:\n  throw new IllegalArgumentException(\"Type not supported by this Flink version: \" + primitive);","handlingStrategy":"validation","validationCode":"for (Types.NestedField f : schema.columns()) { if (f.type().isPrimitiveType()) checkSupported(f.type().asPrimitiveType()); }","typeGuard":"boolean supported(Type t) { return !(t instanceof Type.PrimitiveType) || SUPPORTED.contains(((Type.PrimitiveType) t).typeId()); }","tryCatchPattern":"try { convert(schema); } catch (UnsupportedOperationException e) { LOG.error(\"Unsupported Iceberg type for Flink: {}\", e.getMessage()); throw e; }","preventionTips":["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"],"tags":["flink","type-conversion","schema"],"backgroundTag":"incompatible-source-type","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}