{"record":{"id":"2d1bda3397e26814","repo":"apache/iceberg","slug":"cannot-convert-unknown-type-to-flink-2d1bda","errorCode":null,"errorMessage":"Cannot convert unknown type to Flink: ","messagePattern":"Cannot convert unknown type to Flink: ","errorType":"exception","errorClass":"java.lang.UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"flink/v2.3/flink/src/main/java/org/apache/iceberg/flink/TypeToFlinkType.java","lineNumber":148,"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":130,"sourceCodeEnd":153,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/flink/v2.3/flink/src/main/java/org/apache/iceberg/flink/TypeToFlinkType.java#L130-L153","documentation":"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.","triggerScenarios":"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).","commonSituations":"Version skew: table written by newer Iceberg with types this Flink build's converter doesn't know; programmatically constructed malformed Type objects.","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."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if (type.isPrimitiveType() && !SUPPORTED.contains(type.asPrimitiveType().typeId())) {\n  throw new IllegalArgumentException(\"Unsupported Iceberg type for Flink: \" + type);\n}","typeGuard":null,"tryCatchPattern":"try { flinkType = TypeToFlinkType.toFlinkType(type); } catch (UnsupportedOperationException e) { /* handle unsupported type */ }","preventionTips":["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."],"tags":["flink","type-conversion","schema"],"backgroundTag":"type-mismatch","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"}