apache/beam · error
%T isn't a supported decoder function type
Error message
%T isn't a supported decoder function type (passed with %v), currently expecting %T
What it means
RowDecoderBuilder.Register panics when the supplied f is not a decoderProvider, i.e. not the exact signature func(reflect.Type) (func(io.Reader) (any, error), error). The builder stores custom decoder factories keyed by reflect.Type and cannot accept functions of any other shape.
Solutions
- Change f to exactly func(reflect.Type) (func(io.Reader) (any, error), error)
- Wrap the existing decoder in an adapter closure matching decoderProvider
- Check the Beam version's decoderProvider definition and match it
Example fix
// before
b.Register(reflect.TypeOf(Foo{}), func(r io.Reader) (any, error) { ... })
// after
b.Register(reflect.TypeOf(Foo{}), func(rt reflect.Type) (func(io.Reader) (any, error), error) {
return func(r io.Reader) (any, error) { ... }, nil
}) Defensive patterns
Strategy: validation
Validate before calling
// compile-time shape check var _ rowcoder.DecoderProvider = myDecoderProviderFunc
Type guard
if _, ok := f.(func(reflect.Type) (func(io.Reader) (any, error), error)); !ok {
return fmt.Errorf("f must be a decoderProvider factory")
} Try / catch
func safeRegister(b *rowcoder.RowDecoderBuilder, rt reflect.Type, f any) (err error) {
defer func() {
if r := recover(); r != nil {
err = fmt.Errorf("register decoder: %v", r)
}
}()
b.Register(rt, f)
return nil
} Prevention
- Copy the decoderProvider signature from the Beam source when writing custom decoders
- Pin and review Beam version changes around row coder factories (BEAM-9615)
- Add a compile-time assertion that your function satisfies decoderProvider
When it happens
Trigger: Calling row_decoder_builder.Register(rt, f) where f is a plain decoder func, a closure with the wrong parameter/return types, a method value, or any non-function value.
Common situations: Registering a decoder written for an older Beam API whose signature changed (BEAM-9615 factory types still in flux); passing a partially-applied helper with mismatched types; typos in the return types (io.Reader vs io.ReadCloser).
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
- %T isn't a supported encoder function type
- bad decode
- bad encode
- bad type: , want
- cannot make schema encoder for type
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/f48c7ff49e38ecc9.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/go/pkg/beam/core/graph/coder/row_decoder.go:53
RequireAllFieldsExported bool
}
type decoderProvider = func(reflect.Type) (func(io.Reader) (any, error), error)
// Register accepts a provider to decode schema encoded values
// of that type.
//
// When decoding values, decoder functions produced by this builder will
// first check for exact type matches, then interfaces implemented by
// the type in recency order of registration, and then finally the
// default Beam Schema encoding behavior.
//
// TODO(BEAM-9615): Add final factory types. This interface is subject to change.
// Currently f must be a function func(reflect.Type) (func(io.Reader) (any, error), error)
func (b *RowDecoderBuilder) Register(rt reflect.Type, f any) {
fd, ok := f.(decoderProvider)
if !ok {
panic(fmt.Sprintf("%T isn't a supported decoder function type (passed with %v), currently expecting %T", f, rt, (decoderProvider)(nil)))
}
if rt.Kind() == reflect.Interface && rt.NumMethod() == 0 {
panic(fmt.Sprintf("interface type %v must have methods", rt))
}
if b.allFuncs == nil {
b.allFuncs = make(map[reflect.Type]decoderProvider)
}
b.allFuncs[rt] = fd
if rt.Kind() == reflect.Interface {
b.ifaceFuncs = append(b.ifaceFuncs, rt)
}
}
// Build constructs a Beam Schema coder for the given type, using any providers registered for
// itself or it's fields.
func (b *RowDecoderBuilder) Build(rt reflect.Type) (func(io.Reader) (any, error), error) {View on GitHub (pinned to 12126d8942)