{"record":{"id":"75e205e9ae9e70dd","repo":"apache/iceberg","slug":"type-s-is-not-supported","errorCode":null,"errorMessage":"Type: %s is not supported","messagePattern":"Type: (.+?) is not supported","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/iceberg/SingleValueParser.java","lineNumber":184,"sourceCode":"            defaultValue,\n            defaultLength);\n        byte[] fixedBytes =\n            BaseEncoding.base16().decode(defaultValue.textValue().toUpperCase(Locale.ROOT));\n        return ByteBuffer.wrap(fixedBytes);\n      case BINARY:\n        Preconditions.checkArgument(\n            defaultValue.isTextual(), \"Cannot parse default as a %s value: %s\", type, defaultValue);\n        byte[] binaryBytes =\n            BaseEncoding.base16().decode(defaultValue.textValue().toUpperCase(Locale.ROOT));\n        return ByteBuffer.wrap(binaryBytes);\n      case LIST:\n        return listFromJson(type, defaultValue);\n      case MAP:\n        return mapFromJson(type, defaultValue);\n      case STRUCT:\n        return structFromJson(type, defaultValue);\n      default:\n        throw new UnsupportedOperationException(String.format(\"Type: %s is not supported\", type));\n    }\n  }\n\n  private static StructLike structFromJson(Type type, JsonNode defaultValue) {\n    Preconditions.checkArgument(\n        defaultValue.isObject(), \"Cannot parse default as a %s value: %s\", type, defaultValue);\n    Types.StructType struct = type.asStructType();\n    StructLike defaultRecord = GenericRecord.create(struct);\n\n    List<Types.NestedField> fields = struct.fields();\n    for (int pos = 0; pos < fields.size(); pos += 1) {\n      Types.NestedField field = fields.get(pos);\n      String idString = String.valueOf(field.fieldId());\n      if (defaultValue.has(idString)) {\n        defaultRecord.set(pos, fromJson(field.type(), defaultValue.get(idString)));\n      }\n    }\n    return defaultRecord;","sourceCodeStart":166,"sourceCodeEnd":202,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/SingleValueParser.java#L166-L202","documentation":"SingleValueParser.fromJson switches on the Iceberg type's typeId and only handles primitive, list, map, and struct types. If the typeId falls through to the default branch (unsupported type id), this UnsupportedOperationException is thrown, meaning the type cannot be represented as a single JSON default value.","triggerScenarios":"Calling SingleValueParser.fromJson with a Type whose typeId is not handled by the switch — e.g. a nested/nested-collection variant or future/unknown type id reaching the default branch.","commonSituations":"Parsing schema JSON produced by a newer Iceberg version that introduced a type id this parser does not handle; passing unusual types programmatically when resolving column defaults in table metadata.","solutions":["Upgrade to an Iceberg version whose SingleValueParser supports the type id in question.","Remove or adjust the column default that uses the unsupported type.","If you control the type construction, convert the value yourself instead of routing it through SingleValueParser.fromJson."],"exampleFix":"// before\nObject v = SingleValueParser.fromJson(unknownType, node);\n// after\nif (SUPPORTED_TYPE_IDS.contains(unknownType.typeId())) {\n  Object v = SingleValueParser.fromJson(unknownType, node);\n} else {\n  throw new IllegalStateException(\"Unsupported default type: \" + unknownType);\n}","handlingStrategy":"type-guard","validationCode":"static boolean isSupportedForDefaults(Type t) {\n  switch (t.typeId()) {\n    case BOOLEAN: case INTEGER: case LONG: case FLOAT: case DOUBLE:\n    case DECIMAL: case STRING: case UUID: case DATE: case TIME: case TIMESTAMP:\n    case FIXED: case BINARY:\n    case LIST: case MAP: case STRUCT:\n      return true;\n    default:\n      return false;\n  }\n}","typeGuard":"if (!isSupportedForDefaults(type)) {\n  throw new IllegalStateException(\"Type not supported for JSON default parsing: \" + type);\n}\nObject value = SingleValueParser.fromJson(type, node);","tryCatchPattern":"try {\n  Object value = SingleValueParser.fromJson(type, defaultNode);\n} catch (UnsupportedOperationException e) {\n  LOG.warn(\"Default value type unsupported: {}\", type, e);\n}","preventionTips":["Check the type id against SingleValueParser's supported set before parsing defaults.","Keep Iceberg versions aligned between producers and consumers of metadata JSON.","Avoid attaching defaults to exotic or custom types."],"tags":["java","unsupported-type","json","schema"],"backgroundTag":"unsupported-operation","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"}