{"record":{"id":"b4c873a247e681f3","repo":"apache/beam","slug":"unable-to-decode-type-v","errorCode":null,"errorMessage":"unable to decode type: %v","messagePattern":"unable to decode type: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/graph/coder/row_decoder.go","lineNumber":391,"sourceCode":"\t\treturn typeDecoderFieldReflect{decode: iterableDecoderForSlice(t, decf)}, nil\n\tcase reflect.Array:\n\t\tdecf, err := b.containerDecoderForType(t.Elem())\n\t\tif err != nil {\n\t\t\treturn typeDecoderFieldReflect{}, err\n\t\t}\n\t\treturn typeDecoderFieldReflect{decode: iterableDecoderForArray(t, decf)}, nil\n\tcase reflect.Map:\n\t\tdecK, err := b.containerDecoderForType(t.Key())\n\t\tif err != nil {\n\t\t\treturn typeDecoderFieldReflect{}, err\n\t\t}\n\t\tdecV, err := b.containerDecoderForType(t.Elem())\n\t\tif err != nil {\n\t\t\treturn typeDecoderFieldReflect{}, err\n\t\t}\n\t\treturn typeDecoderFieldReflect{decode: mapDecoder(t, decK, decV)}, nil\n\t}\n\treturn typeDecoderFieldReflect{}, errors.Errorf(\"unable to decode type: %v\", t)\n}\n\nfunc (b *RowDecoderBuilder) containerDecoderForType(t reflect.Type) (typeDecoderFieldReflect, error) {\n\tdec, err := b.decoderForSingleTypeReflect(t)\n\tif err != nil {\n\t\treturn typeDecoderFieldReflect{}, err\n\t}\n\tif t.Kind() == reflect.Ptr {\n\t\treturn typeDecoderFieldReflect{decode: NullableDecoder(dec.decode), addr: dec.addr}, nil\n\t}\n\treturn dec, nil\n}\n\ntype typeDecoderReflect struct {\n\ttyp    reflect.Type\n\tfields []typeDecoderFieldReflect\n}\n","sourceCodeStart":373,"sourceCodeEnd":409,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/graph/coder/row_decoder.go#L373-L409","documentation":"The RowDecoderBuilder encountered a Go type it cannot build a reflective decoder for (a kind not covered by its switch, e.g. unsupported container, channel, func, interface). Beam row coding only supports schema-encodable types.","triggerScenarios":"Calling beam encoding/decoding (DecoderForSlice, struct decoding, containerDecoderForType) on a type like chan, func, interface, or a nested unsupported element type reached recursively from a struct field.","commonSituations":"Users put unsupported field types (e.g. a chan or func) in a PCollection element struct and rely on default reflective row coding.","solutions":["Change the element type to only use supported kinds (primitives, strings, []byte, slices, maps, arrays, structs)","Register a custom coder or implement schema/row encoding manually for the type","Remove or convert the offending field before it enters the PCollection"],"exampleFix":"// before\ntype Event struct { Callback func(int) }\n// after\ntype Event struct { CallbackID string }","handlingStrategy":"validation","validationCode":"func decodable(t reflect.Type) bool {\n    switch t.Kind() {\n    case reflect.Chan, reflect.Func, reflect.Interface, reflect.UnsafePointer:\n        return false\n    }\n    return true\n}","typeGuard":"func isRowDecodable(v any) bool { return decodable(reflect.TypeOf(v)) }","tryCatchPattern":"if _, err := (coder.RowDecoderBuilder{}).Build(t); err != nil {\n    return fmt.Errorf(\"type %T not row-decodable: %w\", v, err)\n}","preventionTips":["Keep PCollection element structs to schema-supported field kinds","Check types with coder.RowDecoderBuilder in tests before deploying","Avoid chan/func/interface fields in pipeline element types"],"tags":["go","beam","reflection","coder"],"backgroundTag":"unsupported-operation","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}