{"record":{"id":"d37259feac7d5a24","repo":"apache/iceberg","slug":"unsupported-basic-type","errorCode":null,"errorMessage":"Unsupported basic type: ","messagePattern":"Unsupported basic type: ","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"api/src/main/java/org/apache/iceberg/variants/VariantUtil.java","lineNumber":71,"sourceCode":"        depth <= MAX_VARIANT_DEPTH,\n        \"Invalid variant: nesting depth %s exceeds maximum %s\",\n        depth,\n        MAX_VARIANT_DEPTH);\n    Preconditions.checkArgument(value.remaining() >= 1, \"Invalid variant: empty value buffer\");\n    int header = ByteBuffers.readByte(value, 0);\n    BasicType basicType = basicType(header);\n    switch (basicType) {\n      case PRIMITIVE:\n        return SerializedPrimitive.from(value, header);\n      case SHORT_STRING:\n        return SerializedShortString.from(value, header);\n      case OBJECT:\n        return SerializedObject.from(metadata, value, header, depth);\n      case ARRAY:\n        return SerializedArray.from(metadata, value, header, depth);\n    }\n\n    throw new UnsupportedOperationException(\"Unsupported basic type: \" + basicType);\n  }\n\n  static float readFloat(ByteBuffer buffer, int offset) {\n    return buffer.getFloat(buffer.position() + offset);\n  }\n\n  static double readDouble(ByteBuffer buffer, int offset) {\n    return buffer.getDouble(buffer.position() + offset);\n  }\n\n  static ByteBuffer slice(ByteBuffer buffer, int offset, int length) {\n    ByteBuffer slice = buffer.duplicate();\n    slice.order(ByteOrder.LITTLE_ENDIAN);\n    slice.position(buffer.position() + offset);\n    slice.limit(buffer.position() + offset + length);\n    return slice;\n  }\n","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/api/src/main/java/org/apache/iceberg/variants/VariantUtil.java#L53-L89","documentation":"VariantUtil.fromBuffer dispatches a serialized variant value by its basic type header (primitive, object, array). A header byte whose basic type is not one of the known values triggers this UnsupportedOperationException, i.e. the value buffer is malformed or uses an unrecognized basic type.","triggerScenarios":"Calling VariantUtil.fromBuffer (or VariantValue.from) on a buffer whose header byte encodes a basic type outside {PRIMITIVE, OBJECT, ARRAY}; corrupted values or newer-spec headers.","commonSituations":"Corrupted data files; reading variants written by newer writers; manual buffer construction with wrong header byte (e.g. header from a large-size variant encoded incorrectly).","solutions":["Upgrade Iceberg to a version that recognizes the basic type code","Verify the value buffer's header byte is valid before decoding","Re-write corrupted variant data from a trusted source"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"int basicBits = (header & 0x03);\nif (basicBits > 2) { throw new IllegalStateException(\"invalid variant basic type bits: \" + basicBits); }","typeGuard":null,"tryCatchPattern":"try {\n  VariantValue v = VariantValue.from(metadata, buffer);\n} catch (UnsupportedOperationException e) {\n  // treat buffer as corrupt; quarantine or re-write\n}","preventionTips":["Validate the header byte's basic-type bits before decoding","Keep reader/writer versions consistent","Regenerate corrupt data files rather than patching buffers"],"tags":["variants","deserialization","malformed-data"],"backgroundTag":"invalid-enum-value","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"}