apache/iceberg · error

Cannot deserialize type: + type

Error message

Cannot deserialize type: + type

What it means

Conversions.internalFromByteBuffer throws UnsupportedOperationException when the supplied type has no deserialization branch, i.e. the typeId is not one of the spec-defined serializable primitives this client supports (e.g. UNKNOWN or a newer spec type).

Source

Thrown at api/src/main/java/org/apache/iceberg/types/Conversions.java:213

        return UUIDUtil.convert(tmp);
      case FIXED:
      case BINARY:
        return tmp;
      case DECIMAL:
        Types.DecimalType decimal = (Types.DecimalType) type;
        byte[] unscaledBytes = new byte[buffer.remaining()];
        tmp.get(unscaledBytes);
        return new BigDecimal(new BigInteger(unscaledBytes), decimal.scale());
      case VARIANT:
        return Variant.from(tmp);
      case GEOMETRY:
      case GEOGRAPHY:
        return GeospatialBound.fromByteBuffer(tmp);
      case UNKNOWN:
        // underlying type not known
        return null;
      default:
        throw new UnsupportedOperationException("Cannot deserialize type: " + type);
    }
  }
}

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Upgrade the Iceberg version supporting the type
  2. Skip unsupported fields when deserializing metadata values
  3. Verify the Type passed is the primitive type matching the serialized bytes

Example fix

// before
Object v = Conversions.fromByteBuffer(field.type(), buffer); // field.type() may be unknown
// after
if (field.type().typeId() != Type.TypeID.UNKNOWN) {
  Object v = Conversions.fromByteBuffer(field.type(), buffer);
}
Defensive patterns

Strategy: type-guard

Validate before calling

if (type.typeId() == Type.TypeID.UNKNOWN) return null;

Type guard

boolean deserializable(Type t) { return t.typeId() != Type.TypeID.UNKNOWN && t.isPrimitiveType(); }

Try / catch

try { v = Conversions.fromByteBuffer(type, buf); } catch (UnsupportedOperationException e) { v = null; }

Prevention

When it happens

Trigger: Calling Conversions.fromByteBuffer with a Type whose typeId falls into the default branch — UNKNOWN types, new geo/variant types on an older client, or a non-primitive type passed by mistake.

Common situations: Deserializing partition or lower/upper-bound values for schemas containing newer spec types with an older Iceberg version; generic code iterating all schema fields.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12). Data as JSON: /api/errors/30438b4ac8646dc1. Report an issue: GitHub.