{"record":{"id":"f2a525ea33572ecb","repo":"apache/iceberg","slug":"unsupported-type-id","errorCode":null,"errorMessage":"Unsupported type ID: ","messagePattern":"Unsupported type ID: ","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/iceberg/avro/TypeToSchema.java","lineNumber":281,"sourceCode":"        break;\n      case BINARY:\n      case GEOMETRY:\n      case GEOGRAPHY:\n        primitiveSchema = BINARY_SCHEMA;\n        break;\n      case DECIMAL:\n        Types.DecimalType decimal = (Types.DecimalType) primitive;\n        primitiveSchema =\n            LogicalTypes.decimal(decimal.precision(), decimal.scale())\n                .addToSchema(\n                    Schema.createFixed(\n                        \"decimal_\" + decimal.precision() + \"_\" + decimal.scale(),\n                        null,\n                        null,\n                        TypeUtil.decimalRequiredBytes(decimal.precision())));\n        break;\n      default:\n        throw new UnsupportedOperationException(\"Unsupported type ID: \" + primitive.typeId());\n    }\n\n    cacheSchema(primitive, primitiveSchema);\n\n    return primitiveSchema;\n  }\n\n  static class WithTypeToName extends TypeToSchema {\n\n    private final Map<Type, Schema> results = Maps.newHashMap();\n\n    WithTypeToName(Map<Types.StructType, String> names) {\n      super((id, struct) -> names.get(struct));\n    }\n\n    Map<Type, Schema> getConversionMap() {\n      return results;\n    }","sourceCodeStart":263,"sourceCodeEnd":299,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/avro/TypeToSchema.java#L263-L299","documentation":"TypeToSchema converts Iceberg primitive types into Avro schemas; when it encounters a primitive type ID it has no Avro mapping for, it throws this UnsupportedOperationException. All standard Iceberg primitive types are handled, so this indicates a type outside the known set.","triggerScenarios":"Calling TypeToSchema (or AvroSchemaUtil.convert on an Iceberg Type) with a Type whose typeId() is unknown to this version, e.g. types added in a newer Iceberg spec or custom Type implementations.","commonSituations":"Version mismatch: newer table metadata or catalog returning newer types consumed by an older Iceberg runtime; wrapping custom types via TypeUtil.","solutions":["Upgrade the Iceberg runtime to a version that supports the type ID in question","Check the type passed in for accidental custom/wrapper types; use the canonical Iceberg Types.* primitives","Rebuild dependent code against the same Iceberg version used to write the metadata"],"exampleFix":"// before\nType t = myCustomWrapperType();\nSchema s = AvroSchemaUtil.convert(t, \"root\");\n// after\nType t = Types.StringType.get();\nSchema s = AvroSchemaUtil.convert(t, \"root\");","handlingStrategy":"validation","validationCode":"if (!(type instanceof Types.StringType || type instanceof Types.LongType || /* all supported primitives */ type instanceof Types.IntegerType)) { throw new IllegalStateException(\"unsupported primitive: \" + type); }","typeGuard":"boolean isSupportedPrimitive(Type t) { return t.isPrimitiveType() && t.typeId() != Type.TypeID.UNKNOWN; }","tryCatchPattern":"try { Schema s = AvroSchemaUtil.convert(type, \"root\"); } catch (UnsupportedOperationException e) { if (e.getMessage().startsWith(\"Unsupported type ID\")) { /* align Iceberg versions */ } else throw e; }","preventionTips":["Keep producer and consumer Iceberg versions aligned","Only use canonical Types.* primitives","Check release notes when a new spec adds types"],"tags":["avro","unsupported-type","schema-conversion"],"backgroundTag":"unsupported-enum-value","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}