{"record":{"id":"2d0627f8211668c4","repo":"apache/beam","slug":"method-v-has-sdf-rtracker-as-param-v-expected-none","errorCode":null,"errorMessage":"method %v has sdf.RTracker as param %v, expected none","messagePattern":"method (.+?) has sdf\\.RTracker as param (.+?), expected none","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/graph/fn.go","lineNumber":877,"sourceCode":"\t\t\tmissing = append(missing, name)\n\t\t}\n\t}\n\n\tvar isSdf bool\n\tswitch len(missing) {\n\tcase 0: // All SDF methods present.\n\t\tisSdf = true\n\tcase len(requiredSdfNames): // No SDF methods.\n\t\tisSdf = false\n\tdefault: // Anything else means an invalid # of SDF methods.\n\t\terr := errors.Errorf(\"not all required SplittableDoFn methods are present. Missing methods: %v\", missing)\n\t\treturn false, err\n\t}\n\n\tprocessFn := fn.methods[processElementName]\n\tif pos, ok := processFn.RTracker(); ok != isSdf {\n\t\tif ok {\n\t\t\terr := errors.Errorf(\"method %v has sdf.RTracker as param %v, expected none\",\n\t\t\t\tprocessElementName, pos)\n\t\t\treturn false, errors.SetTopLevelMsgf(err, \"Method %v has an sdf.RTracker parameter at index %v, \"+\n\t\t\t\t\"but is not part of a splittable DoFn. sdf.RTracker is invalid in %v in non-splittable DoFns.\",\n\t\t\t\tprocessElementName, pos, processElementName)\n\t\t}\n\t\tpos, _, _ = processFn.Inputs()\n\t\terr := errors.Errorf(\"method %v missing sdf.RTracker, expected one at index %v\",\n\t\t\tprocessElementName, pos)\n\t\treturn false, errors.SetTopLevelMsgf(err, \"Method %v is missing an sdf.RTracker \"+\n\t\t\t\"parameter despite being part of a splittable DoFn. %v in splittable DoFns requires an \"+\n\t\t\t\"sdf.RTracker parameter before main inputs (in this case, at index %v).\",\n\t\t\tprocessElementName, processElementName, pos)\n\t}\n\treturn isSdf, nil\n}\n\n// validateSdfSignatures validates that types in the SDF methods of a Fn are\n// consistent with each other (for example, element and restriction types should","sourceCodeStart":859,"sourceCodeEnd":895,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/graph/fn.go#L859-L895","documentation":"validateIsSdf checks ProcessElement for an sdf.RTracker parameter. If ProcessElement has an sdf.RTracker parameter but the DoFn was not determined to be a SplittableDoFn (isSdf false), this error is thrown: the RTracker parameter is only valid in splittable DoFns.","triggerScenarios":"Adding sdf.RTracker to ProcessElement without implementing the complete set of required SDF methods (either no SDF methods or an inconsistent set already rejected), then calling AsDoFn via beam.ParDo.","commonSituations":"Copying only the ProcessElement signature from an SDF example without the other SDF methods; deleting the SDF helper methods during refactoring while keeping the RTracker parameter; typos in required SDF method names so they aren't detected.","solutions":["Implement all required SDF methods so the DoFn qualifies as a SplittableDoFn.","Or remove the sdf.RTracker parameter from ProcessElement if the DoFn should not be splittable.","Check required SDF method signatures/names are exactly as Beam expects."],"exampleFix":"// before\nfunc (fn *myFn) ProcessElement(rt sdf.RTracker, w string, emit func(int)) {}\n// no CreateInitialRestriction etc.\n\n// after: either add the full SDF method set, or\nfunc (fn *myFn) ProcessElement(w string, emit func(int)) {} // non-splittable","handlingStrategy":"validation","validationCode":"// only add sdf.RTracker to ProcessElement once the full SDF method set exists:\nif _, ok := reflect.TypeOf(fn).MethodByName(\"CreateInitialRestriction\"); !ok { /* don't use RTracker yet */ }","typeGuard":"func sdfReady(fn interface{}) bool { return isCompleteSdf(fn) } // complete set before using RTracker","tryCatchPattern":"if err := beam.ParDo(s, fn, in); err != nil {\n\tif strings.Contains(err.Error(), \"sdf.RTracker\") { log.Fatalf(\"RTracker used in non-splittable DoFn: %v\", err) }\n}","preventionTips":["Add RTracker to ProcessElement only as the final step of SDF migration","Never delete SDF helper methods without removing the RTracker parameter","Verify method names/signatures of required SDF methods against Beam docs"],"tags":["go","apache-beam","splittable-dofn","sdf","rtracker"],"backgroundTag":"invalid-argument-value","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}