apache/beam · error
unable to convert array element type
Error message
unable to convert array element type
What it means
Wrapper error raised when the element type of an ArrayType field fails recursive conversion in Registry.fieldTypeToReflectType. The array itself is representable; its element type is not (unknown atomic, unregistered logical type, or nested unsupported container), and this message adds array context.
Solutions
- Follow the wrapped inner error to the failing element type
- Register the missing logical type URN before calling ToType
- Upgrade the Go SDK if the element is a newer atomic type
- Change the producer schema so array elements use supported types
Example fix
// before: array of unregistered logical type
// after
schema.RegisterLogicalType(uuidProvider{}) // makes []uuid elements convertible Defensive patterns
Strategy: try-catch
Try / catch
if err != nil && strings.Contains(err.Error(), "unable to convert array element type") {
return fmt.Errorf("array element unsupported in schema: %w", err)
} Prevention
- Register logical types used as array elements before ToType
- Keep array elements to atoms or registered structs
- Round-trip test schemas received from other SDKs
When it happens
Trigger: fieldToStructField/toType processing a schema whose FieldType_ArrayType element fails fieldTypeToReflectType — e.g. elements are an unmapped AtomicType or an unregistered logical type.
Common situations: Reconstructing Go types from schemas received from other SDKs or stored pipelines where the array's element type references a logical type absent from the current process's registry.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- array len mismatch. decoding
- beam.RegisterSchemaProvider: schema type provider for
- beam.RegisterSchemaProvider: unsupported type kind for…
- cannot convert schema field
- invalid logical type, bad id
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/c7ccf11421c9fcae.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/go/pkg/beam/core/runtime/graphx/schema/schema.go:772
pipepb.AtomicType_FLOAT: reflectx.Float32,
pipepb.AtomicType_DOUBLE: reflectx.Float64,
pipepb.AtomicType_STRING: reflectx.String,
pipepb.AtomicType_BOOLEAN: reflectx.Bool,
pipepb.AtomicType_BYTES: reflectx.ByteSlice,
}
func (r *Registry) fieldTypeToReflectType(sft *pipepb.FieldType, opts []*pipepb.Option) (reflect.Type, error) {
var t reflect.Type
switch sft.GetTypeInfo().(type) {
case *pipepb.FieldType_AtomicType:
var ok bool
if t, ok = atomicTypeToReflectType[sft.GetAtomicType()]; !ok {
return nil, errors.Errorf("unknown atomic type: %v", sft.GetAtomicType())
}
case *pipepb.FieldType_ArrayType:
rt, err := r.fieldTypeToReflectType(sft.GetArrayType().GetElementType(), nil)
if err != nil {
return nil, errors.Wrap(err, "unable to convert array element type")
}
t = reflect.SliceOf(rt)
case *pipepb.FieldType_MapType:
kt, err := r.fieldTypeToReflectType(sft.GetMapType().GetKeyType(), nil)
if err != nil {
return nil, errors.Wrap(err, "unable to convert map key type")
}
vt, err := r.fieldTypeToReflectType(sft.GetMapType().GetValueType(), nil)
if err != nil {
return nil, errors.Wrap(err, "unable to convert map value type")
}
t = reflect.MapOf(kt, vt) // Panics for invalid map keys (slices/iterables)
case *pipepb.FieldType_RowType:
rt, err := r.toType(sft.GetRowType().GetSchema())
if err != nil {
return nil, errors.Wrapf(err, "unable to convert row type: %v", sft.GetRowType().GetSchema().GetId())
}
t = rtView on GitHub (pinned to 12126d8942)