apache/beam · error · IllegalArgumentException
Value ${value} of class ${valueClass} is not a supported typ
Error message
Value ${value} of class ${valueClass} is not a supported type for logical type ${logicalTypeName} (${logicalType}). Underlying avro built-in raw type should be instance of ${desiredRawType}. However it is instance of ${rawTypeClass} and has value ${rawValue} .Generic data has conversion ${conversion}, convertedType ${convertedType} What it means
checkRawType validates, during Avro logical-type value conversion, that the raw (underlying built-in Avro type) value actually is an instance of the class the logical type expects (e.g., a decimal logical type expects a ByteBuffer/Long raw value). If not — usually because a Conversion is missing, wrong, or the value bypassed normal Avro conversion — a detailed IllegalArgumentException is thrown describing the value, its class, the logical type, the expected raw type, and the registered conversion.
Source
Thrown at sdks/java/extensions/avro/src/main/java/org/apache/beam/sdk/extensions/avro/schemas/utils/AvroUtils.java:1807
Conversion<?> conversion,
Class<?> convertedType) {
String msg =
String.format(
"Value %s of class %s is not a supported type for logical type %s (%s). "
+ "Underlying avro built-in raw type should be instance of %s. "
+ "However it is instance of %s and has value %s ."
+ "Generic data has conversion %s, convertedType %s",
value,
value.getClass(),
logicalType.getName(),
logicalType,
desiredRawType,
rawType.getClass(),
rawType,
conversion,
convertedType);
if (!desiredRawType.isInstance(rawType)) {
throw new IllegalArgumentException(msg);
}
return (T) rawType;
}
}
View on GitHub (pinned to 12126d8942)
Solutions
- Register the proper Conversion for the logical type on the GenericData used (e.g., Conversions.DecimalConversion via genericData.addLogicalTypeConversion).
- Verify the writer schema: confirm the underlying Avro raw type matches the logical type spec (decimal -> bytes/fixed, timestamp-millis -> long, etc.) and fix the data or schema if it doesn't.
- Pre-convert the value yourself (MapElements) to the expected raw type before strict conversion.
- If reading files, ensure reader and writer schemas agree via Avro schema resolution instead of forcing strict conversion.
Example fix
// before GenericData genericData = new GenericData(); Object v = AvroUtils.convertAvroFieldStrict(raw, schema, fieldType); // decimal stored as raw, no conversion // after GenericData genericData = new GenericData(); genericData.addLogicalTypeConversion(new Conversions.DecimalConversion());
Defensive patterns
Strategy: validation
Validate before calling
Schema.Type raw = schema.getType();
LogicalType lt = schema.getLogicalType();
if (lt != null) {
boolean ok =
(lt instanceof Conversions.DecimalConversion && (raw == Schema.Type.BYTES || raw == Schema.Type.FIXED))
|| (lt instanceof TimeConversions.TimestampMillisConversion && raw == Schema.Type.LONG);
if (!ok) throw new IllegalStateException("unexpected raw type " + raw + " for logical type " + lt);
} Try / catch
try {
return AvroUtils.convertAvroFieldStrict(value, schema, fieldType);
} catch (IllegalArgumentException e) {
if (e.getMessage().contains("is not a supported type for logical type")) {
// register missing Conversion or repair the writer schema
} else { throw e; }
} Prevention
- Always register logical-type Conversions (decimal, timestamp, etc.) on the GenericData used for conversion.
- Validate writer schemas in CI against the logical-type spec.
- Log the raw value class when logical-type conversions fail to spot writer/reader mismatches early.
When it happens
Trigger: Calling convertAvroFieldStrict on a field whose Avro schema carries a logicalType where the value stored in the GenericRecord is the raw built-in type but not of the expected class — e.g., a 'decimal' logical type whose value is a String/Integer instead of ByteBuffer or CharSequence, or a logical type with no Conversion registered in the GenericData so the raw value reaches checkRawType unconverted.
Common situations: Reading Avro data written by another tool that stored logical-type fields with a different underlying raw type; forgetting to register a Conversion for a custom logical type (GenericData.get().addLogicalTypeConversion(...)); Avro version differences that changed the raw representation of a logical type (e.g., timestamp-millis); decimal values deserialized as GenericFixed instead of BigDecimal.
Understand the failure class
Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.
Related errors
- Timestamp logical type precision not supported:${precision}
- Unhandled logical type ${identifier}
- Can't convert 'string' map keys to ${mapKeyType}
- Error converting field :
- Unknown logical type
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/f615049e2cfe6620.
Report an issue: GitHub.