{"record":{"id":"23616b8a060ee150","repo":"apache/beam","slug":"v-not-found-register-dofns-and-functions-with-the-beam","errorCode":null,"errorMessage":"%v not found. Register DoFns and functions with the beam/register package.","messagePattern":"(.+?) not found\\. Register DoFns and functions with the beam/register package\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/runners/vet/vet.go","lineNumber":58,"sourceCode":"\t\"github.com/apache/beam/sdks/v2/go/pkg/beam/core/funcx\"\n\t\"github.com/apache/beam/sdks/v2/go/pkg/beam/core/graph\"\n\t\"github.com/apache/beam/sdks/v2/go/pkg/beam/core/runtime\"\n\t\"github.com/apache/beam/sdks/v2/go/pkg/beam/core/runtime/exec\"\n\t\"github.com/apache/beam/sdks/v2/go/pkg/beam/core/typex\"\n\t\"github.com/apache/beam/sdks/v2/go/pkg/beam/core/util/reflectx\"\n\t\"github.com/apache/beam/sdks/v2/go/pkg/beam/internal/errors\"\n)\n\nfunc init() {\n\tbeam.RegisterRunner(\"vet\", Execute)\n}\n\n// We want clear failures when looking up symbols so we can tell if something has been\n// registered properly or not.\ntype disabledResolver bool\n\nfunc (p disabledResolver) Sym2Addr(name string) (uintptr, error) {\n\treturn 0, errors.Errorf(\"%v not found. Register DoFns and functions with the beam/register package.\", name)\n}\n\n// Execute evaluates the pipeline on whether it can run without reflection.\nfunc Execute(ctx context.Context, p *beam.Pipeline) (beam.PipelineResult, error) {\n\te, err := Evaluate(ctx, p)\n\tif err != nil {\n\t\treturn nil, errors.WithContext(err, \"validating pipeline with vet runner\")\n\t}\n\tif !e.Performant() {\n\t\te.summary()\n\t\te.Generate(\"main\")\n\t\te.diag(\"*/\\n\")\n\t\terr := errors.Errorf(\"pipeline is not performant, see diagnostic summary:\\n%s\\n%s\", e.d.String(), string(e.Bytes()))\n\t\terr = errors.WithContext(err, \"validating pipeline with vet runner\")\n\t\treturn nil, errors.SetTopLevelMsg(err, \"pipeline is not performant\")\n\t}\n\t// Pipeline nas no further tasks.\n\treturn nil, nil","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/runners/vet/vet.go#L40-L76","documentation":"vet's disabledResolver intentionally fails every symbol lookup with this message so reflection-based resolution surfaces as a clear error. It means the vet runner encountered a DoFn or function that was never registered with the beam/register package and so cannot be resolved statically.","triggerScenarios":"Running a pipeline through vet.Evaluate/Execute where symbol resolution calls p.Sym2Addr(name) for a symbol absent from the register package — typically an unregistered DoFn or an inline closure.","commonSituations":"Refactoring a DoFn and dropping its init() registration; using anonymous closures or generic helpers instead of registered types; adding a new function to a pipeline without registering it.","solutions":["Register the named symbol in an init() via beam/register (e.g. register.DoFn2x0[...](&MyDoFn{})).","Replace anonymous closures with named, registered function types.","Check the error message for the exact symbol name and register precisely that.","Remove dynamic dispatch that cannot be statically registered."],"exampleFix":"// before\nfunc main() {\n\tbeam.Init()\n\tbeam.ParDo(scope, &myDoFn{}, col) // not registered\n}\n// after\nfunc init() {\n\tregister.DoFn2x0[int, func(int)](&myDoFn{})\n}\nfunc main() {\n\tbeam.Init()\n\tbeam.ParDo(scope, &myDoFn{}, col)\n}","handlingStrategy":"validation","validationCode":"func allRegistered() error {\n\t// every DoFn must be registered in an init() via beam/register\n\tif myDoFnAddr == 0 {\n\t\treturn errors.New(\"myDoFn not registered\")\n\t}\n\treturn nil\n}","typeGuard":null,"tryCatchPattern":"if _, err := vet.Execute(ctx, p); err != nil {\n\tif strings.Contains(err.Error(), \"not found. Register DoFns\") {\n\t\t// add the missing register.DoFn2x0/register.Function1x1 init entry\n\t}\n}","preventionTips":["Register every DoFn and function in init() with beam/register.","Avoid anonymous closures in pipeline graphs.","Add a CI vet gate to catch unregistered symbols early."],"tags":["go","beam","register","reflection"],"backgroundTag":"class-not-found","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"}