{"record":{"id":"2ee2a82ae006cb0f","repo":"apache/iceberg","slug":"can-t-convert-unknown-type-nested","errorCode":null,"errorMessage":"Can't convert unknown type: ${nested}","messagePattern":"Can't convert unknown type: (.+?)","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"parquet/src/main/java/org/apache/iceberg/parquet/TypeToMessageType.java","lineNumber":138,"sourceCode":"    if (field.type().typeId() == TypeID.UNKNOWN) {\n      return null;\n\n    } else if (field.type().isPrimitiveType()) {\n      return primitive(field.type().asPrimitiveType(), repetition, id, name);\n\n    } else if (field.type().isVariantType()) {\n      return variant(repetition, id, name);\n\n    } else {\n      NestedType nested = field.type().asNestedType();\n      if (nested.isStructType()) {\n        return struct(nested.asStructType(), repetition, id, name);\n      } else if (nested.isMapType()) {\n        return map(nested.asMapType(), repetition, id, name);\n      } else if (nested.isListType()) {\n        return list(nested.asListType(), repetition, id, name);\n      }\n      throw new UnsupportedOperationException(\"Can't convert unknown type: \" + nested);\n    }\n  }\n\n  public GroupType list(ListType list, Type.Repetition repetition, int id, String name) {\n    NestedField elementField = list.fields().get(0);\n    Type elementType = field(elementField);\n    Preconditions.checkArgument(\n        elementType != null, \"Cannot convert element Parquet: %s\", elementField.type());\n\n    return Types.list(repetition)\n        .element(elementType)\n        .id(id)\n        .named(AvroSchemaUtil.makeCompatibleName(name));\n  }\n\n  public GroupType map(MapType map, Type.Repetition repetition, int id, String name) {\n    NestedField keyField = map.fields().get(0);\n    NestedField valueField = map.fields().get(1);","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/parquet/src/main/java/org/apache/iceberg/parquet/TypeToMessageType.java#L120-L156","documentation":"TypeToMessageType converts Iceberg types (nested variants: struct, map, list) into Parquet GroupType/PrimitiveType schemas. When the provided nested Iceberg type is none of struct, map, or list, the converter has no Parquet representation and throws UnsupportedOperationException with the type's string form.","triggerScenarios":"Calling TypeToMessageType.field()/struct()/map()/list() with a nested field whose type is neither a StructType, MapType, nor ListType (i.e. a primitive reaching the nested dispatch path, or an unknown/unrecognized Type implementation).","commonSituations":"Custom or future Iceberg Type implementations not yet known to the converter; a bug where a primitive type is passed to the nested-type branch; version mismatch where a newer Iceberg type meets an older parquet module.","solutions":["Inspect the type printed in the message and ensure nested conversion is only invoked for struct/map/list types.","Route primitive types through the primitive(...) conversion path instead of the nested branch.","Upgrade the iceberg-parquet module so it recognizes the type (custom types require explicit converter support)."],"exampleFix":"// before\nType nested = field.type(); // unrecognized type\nconvertNested(nested);\n// after\nif (nested.isStructType() || nested.isMapType() || nested.isListType()) {\n  convertNested(nested);\n} else if (nested.isPrimitiveType()) {\n  primitive(nested.asPrimitiveType(), repetition, id, name);\n}","handlingStrategy":"validation","validationCode":"void validateNested(Type t) {\n  Preconditions.checkArgument(t.isStructType() || t.isMapType() || t.isListType(),\n      \"Expected nested type (struct/map/list), got: %s\", t);\n}","typeGuard":"boolean isNested(Type t) { return t.isStructType() || t.isMapType() || t.isListType(); }","tryCatchPattern":"try {\n  parquetSchema = converter.convert(icebergType);\n} catch (UnsupportedOperationException e) {\n  throw new IllegalArgumentException(\"Type not convertible to Parquet: \" + e.getMessage(), e);\n}","preventionTips":["Only pass struct/map/list types to the nested conversion path; send primitives to primitive().","Keep iceberg-parquet on the same version as iceberg-core to recognize all types.","Reject unknown custom types at schema-load time."],"tags":["parquet","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-23T08:17:48.524Z"}