apache/beam · error
unable to convert unsupported type %v to schema
Error message
unable to convert unsupported type %v to schema
What it means
Thrown when reflectTypeToFieldType encounters a Go type of a fundamentally unsupported reflect.Kind: Interface, Func, Chan, UnsafePointer, Complex128, Complex64, or Invalid. Beam schemas have no representation for these kinds, so conversion fails immediately with this non-wrapped error.
Source
Thrown at sdks/go/pkg/beam/core/runtime/graphx/schema/schema.go:644
return &pipepb.FieldType{
TypeInfo: &pipepb.FieldType_AtomicType{
AtomicType: pipepb.AtomicType_BYTES,
},
}, nil
}
vt, err := r.reflectTypeToFieldType(t.Elem())
if err != nil {
return nil, errors.Wrapf(err, "unable to convert element type of %v to schema field", ot)
}
return &pipepb.FieldType{
TypeInfo: &pipepb.FieldType_ArrayType{
ArrayType: &pipepb.ArrayType{
ElementType: vt,
},
},
}, nil
case reflect.Interface, reflect.Func, reflect.Chan, reflect.UnsafePointer, reflect.Complex128, reflect.Complex64, reflect.Invalid:
return nil, errors.Errorf("unable to convert unsupported type %v to schema", ot)
default: // must be an atomic type
if enum, ok := reflectTypeToAtomicTypeMap[t.Kind()]; ok {
return &pipepb.FieldType{
TypeInfo: &pipepb.FieldType_AtomicType{
AtomicType: enum,
},
}, nil
}
return nil, errors.Errorf("unable to map %v to pipepb.AtomicType", t)
}
}
var reflectTypeToAtomicTypeMap = map[reflect.Kind]pipepb.AtomicType{
reflect.Uint8: pipepb.AtomicType_BYTE,
reflect.Int16: pipepb.AtomicType_INT16,
reflect.Int32: pipepb.AtomicType_INT32,
reflect.Int64: pipepb.AtomicType_INT64,
reflect.Float32: pipepb.AtomicType_FLOAT,View on GitHub (pinned to 12126d8942)
Solutions
- Remove the unsupported-kind field from the struct or replace it with a concrete supported type
- Use schema.RegisterAssignableType to map the type onto a convertible representation
- Encode the data as bytes/string with custom serialization before it enters the pipeline
- Use a non-schema coder (cache.CustomTypeEncoder/Decoder) for the affected type
Example fix
// before
type Job struct { Done chan struct{} }
// after
type Job struct { Done bool } Defensive patterns
Strategy: type-guard
Type guard
func schemaSupportedKind(k reflect.Kind) bool {
switch k {
case reflect.Interface, reflect.Func, reflect.Chan, reflect.UnsafePointer, reflect.Complex128, reflect.Complex64, reflect.Invalid:
return false
}
return true
} Try / catch
if err := isSchemaSafe(t); err != nil {
return fmt.Errorf("type %v uses an unsupported kind: %w", t, err)
} Prevention
- Lint or code-review pipeline structs for chan/func/interface/complex fields
- Move non-data fields (closures, channels) out of serialized payload structs
- Use custom coders for inherently non-schema types
When it happens
Trigger: Any schema encoding path (RegisterLogicalType, structToSchema, ToType round-trip) that reaches a field or nested type whose reflect.Kind is one of the unsupported kinds listed in the switch.
Common situations: Structs containing callback fields, dependency-injection interfaces, channels, or complex numbers passed to Beam pipelines that use schema coders; also a nil/invalid reflect.Type slipping in from a failed lookup.
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
- Field type%s %s not supported when converting between JSON a
- Unknown BigQuery type: " + bqType
- Unknown Avro type: " + type.getType()
- Encountered a type that is not currently supported by RowCod
- unable to provide schema.LogicalType for type %v, want %v
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/47d9cafb5adf33c6.
Report an issue: GitHub.