apache/iceberg · error · UnsupportedOperationException
Type: %s is not supported
Error message
Type: %s is not supported
What it means
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.
Source
Thrown at core/src/main/java/org/apache/iceberg/SingleValueParser.java:184
defaultValue,
defaultLength);
byte[] fixedBytes =
BaseEncoding.base16().decode(defaultValue.textValue().toUpperCase(Locale.ROOT));
return ByteBuffer.wrap(fixedBytes);
case BINARY:
Preconditions.checkArgument(
defaultValue.isTextual(), "Cannot parse default as a %s value: %s", type, defaultValue);
byte[] binaryBytes =
BaseEncoding.base16().decode(defaultValue.textValue().toUpperCase(Locale.ROOT));
return ByteBuffer.wrap(binaryBytes);
case LIST:
return listFromJson(type, defaultValue);
case MAP:
return mapFromJson(type, defaultValue);
case STRUCT:
return structFromJson(type, defaultValue);
default:
throw new UnsupportedOperationException(String.format("Type: %s is not supported", type));
}
}
private static StructLike structFromJson(Type type, JsonNode defaultValue) {
Preconditions.checkArgument(
defaultValue.isObject(), "Cannot parse default as a %s value: %s", type, defaultValue);
Types.StructType struct = type.asStructType();
StructLike defaultRecord = GenericRecord.create(struct);
List<Types.NestedField> fields = struct.fields();
for (int pos = 0; pos < fields.size(); pos += 1) {
Types.NestedField field = fields.get(pos);
String idString = String.valueOf(field.fieldId());
if (defaultValue.has(idString)) {
defaultRecord.set(pos, fromJson(field.type(), defaultValue.get(idString)));
}
}
return defaultRecord;View on GitHub (pinned to 86d9c8fc54)
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.
Example fix
// before
Object v = SingleValueParser.fromJson(unknownType, node);
// after
if (SUPPORTED_TYPE_IDS.contains(unknownType.typeId())) {
Object v = SingleValueParser.fromJson(unknownType, node);
} else {
throw new IllegalStateException("Unsupported default type: " + unknownType);
} Defensive patterns
Strategy: type-guard
Validate before calling
static boolean isSupportedForDefaults(Type t) {
switch (t.typeId()) {
case BOOLEAN: case INTEGER: case LONG: case FLOAT: case DOUBLE:
case DECIMAL: case STRING: case UUID: case DATE: case TIME: case TIMESTAMP:
case FIXED: case BINARY:
case LIST: case MAP: case STRUCT:
return true;
default:
return false;
}
} Type guard
if (!isSupportedForDefaults(type)) {
throw new IllegalStateException("Type not supported for JSON default parsing: " + type);
}
Object value = SingleValueParser.fromJson(type, node); Try / catch
try {
Object value = SingleValueParser.fromJson(type, defaultNode);
} catch (UnsupportedOperationException e) {
LOG.warn("Default value type unsupported: {}", type, e);
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
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
- Cannot parse default as a %s value: %s
- Cannot truncate type: + type
- Field + name + not found in source schema
- Cannot parse type string to primitive: + typeString
- Invalid default value for %s: %s (must be null)
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/75e205e9ae9e70dd.
Report an issue: GitHub.