{"record":{"id":"4e7f963c3ced8ea0","repo":"apache/beam","slug":"bad-type","errorCode":null,"errorMessage":"bad type","messagePattern":"bad type","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/runtime/graphx/serialize.go","lineNumber":279,"sourceCode":"\t\t}\n\t\treturn &v1pb.Fn{Type: typ, Opt: string(data)}, nil\n\n\tdefault:\n\t\treturn nil, errors.Errorf(\"failed to encode DoFn %v, missing fn\", u)\n\t}\n}\n\nfunc decodeFn(u *v1pb.Fn) (*graph.Fn, error) {\n\tif u.Dynfn != nil {\n\t\tgen, err := runtime.ResolveFunction(u.Dynfn.Gen, genFnType)\n\t\tif err != nil {\n\t\t\twrapped := errors.Wrapf(err, \"bad symbol %v\", u.Dynfn.Gen)\n\t\t\treturn nil, errors.WithContextf(wrapped, \"decoding dynamic DoFn %v\", u)\n\t\t}\n\n\t\tt, err := decodeType(u.Dynfn.Type)\n\t\tif err != nil {\n\t\t\twrapped := errors.Wrap(err, \"bad type\")\n\t\t\treturn nil, errors.WithContextf(wrapped, \"failed to decode dynamic DoFn %v\", u)\n\t\t}\n\t\treturn graph.NewFn(&graph.DynFn{\n\t\t\tName: u.Dynfn.Name,\n\t\t\tT:    t,\n\t\t\tData: u.Dynfn.Data,\n\t\t\tGen:  gen.(func(string, reflect.Type, []byte) reflectx.Func),\n\t\t})\n\t}\n\tif u.Fn != nil {\n\t\tfn, err := decodeUserFn(u.Fn)\n\t\tif err != nil {\n\t\t\twrapped := errors.Wrap(err, \"failed to decode userfn\")\n\t\t\treturn nil, errors.WithContextf(wrapped, \"decoding DoFn %v\", u)\n\t\t}\n\t\tfx, err := funcx.New(reflectx.MakeFunc(fn))\n\t\tif err != nil {\n\t\t\twrapped := errors.Wrap(err, \"failed to construct userfn\")","sourceCodeStart":261,"sourceCodeEnd":297,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/graphx/serialize.go#L261-L297","documentation":"decodeFn fails to decode the dynamic DoFn's receiver type from the encoded type descriptor (decodeType on u.Dynfn.Type), wrapped as \"bad type\". The type referenced in the pipeline proto cannot be reconstructed in the worker's runtime type registry.","triggerScenarios":"DecodeMultiEdge decoding a DynFn whose encoded Type refers to a type not registered/lookup-able in the worker process.","commonSituations":"Type registered only in the driver; type renamed or moved between submit and run; worker container built from different code than the submitter.","solutions":["Register the receiver type via runtime.RegisterType in a package imported by the worker.","Rebuild the worker/container from the same code revision as the pipeline submission.","Verify with runtime.LookupType(runtime.TypeKey(...)) in the worker that the type resolves.","Align Beam Go SDK versions between submitter and worker image."],"exampleFix":"// before\n// worker: type not registered anywhere\n\n// after\n// package imported by worker main\nfunc init() { runtime.RegisterType(reflect.TypeOf(myFn{})) }","handlingStrategy":"validation","validationCode":"k, _ := runtime.TypeKey(reflectx.SkipPtr(reflect.TypeOf(myFn{})))\nif _, ok := runtime.LookupType(k); !ok {\n    runtime.RegisterType(reflect.TypeOf(myFn{}))\n}","typeGuard":"func typeResolvable(t reflect.Type) bool {\n    k, ok := runtime.TypeKey(reflectx.SkipPtr(t))\n    if !ok { return false }\n    _, ok = runtime.LookupType(k)\n    return ok\n}","tryCatchPattern":null,"preventionTips":["Import type-registration packages in the worker binary.","Keep DoFn type names/paths stable across deploys.","Test decode paths in worker-like binaries, not just the driver."],"tags":["go","deserialization","type-registry","apache-beam"],"backgroundTag":"type-mismatch","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"}