{"record":{"id":"036399e48be5d9c1","repo":"apache/beam","slug":"createtracker-has-unexpected-number-of-parameters-v-sdf","errorCode":null,"errorMessage":"CreateTracker has unexpected number of parameters: %v","messagePattern":"CreateTracker has unexpected number of parameters: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"sdks/go/pkg/beam/core/runtime/exec/sdf_invokers_arity.tmpl","lineNumber":184,"sourceCode":"{{range $in := upto 3}}\n    {{if gt $out 0}}\n    {{if gt $in 0}}\n\tcase reflectx.Func{{$in}}x{{$out}}:\n\t\tn.call = func() (rt sdf.RTracker, err error) {\n\t\t\t{{mktuplef $out \"r%v\"}} := fnT.Call{{$in}}x{{$out}}({{mktuplef $in \"n.args[%v]\"}})\n\t\t\t{{- if eq $out 1}}\n\t\t\treturn r0.(sdf.RTracker), nil\n\t\t\t{{- else}}\n\t\t\treturn r0.(sdf.RTracker), asError(r1)\n\t\t\t{{- end}}\n\t\t}\n\t{{end}}\n\t{{end}}\n{{end}}\n{{end}}\n\tdefault:\n\t\tif len(n.fn.Param) < 1 || len(n.fn.Param) > 2 {\n\t\t\treturn errors.Errorf(\"CreateTracker has unexpected number of parameters: %v\", len(n.fn.Param))\n\t\t}\n\n\t\tn.call = func() (rt sdf.RTracker, err error) {\n\t\t\tret := n.fn.Fn.Call(n.args)\n\n\t\t\tswitch len(ret) {\n\t\t\tcase 1:\n\t\t\t\treturn ret[0].(sdf.RTracker), nil\n\t\t\tcase 2:\n\t\t\t\treturn ret[0].(sdf.RTracker), asError(ret[1])\n\t\t\t}\n\n\t\t\tpanic(fmt.Sprintf(\"CreateTracker has unexpected number of return values: %v\", len(ret)))\n\t\t}\n\t}\n\n\treturn nil\n}","sourceCodeStart":166,"sourceCodeEnd":202,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/exec/sdf_invokers_arity.tmpl#L166-L202","documentation":"This panic comes from the generated SDF invoker code in the Beam Go SDK. When a splittable DoFn's CreateTracker method has a signature whose parameter count is outside the 1-2 range the framework supports (1 param: restriction, or 2 params: restriction + element), the exec runtime cannot build a caller for it and panics.","triggerScenarios":"Registering a splittable DoFn whose CreateTracker method takes 0 parameters, or 3+ parameters (e.g. restriction + element + extra context param), then executing the pipeline so the generated arity-dispatch code hits its default branch.","commonSituations":"Refactoring CreateTracker to add a context or bookkeeping parameter; copying a DoFn skeleton and accidentally changing the signature; typos so the method no longer matches the expected SDF shape.","solutions":["Change CreateTracker to accept exactly 1 parameter (the restriction) or 2 parameters (restriction and element)","Verify the function is actually a splittable DoFn and the method name/signature matches the SDF contract","Check the Beam Go SDK docs for supported CreateTracker signatures for your version","If you need extra data, capture it in the DoFn struct instead of adding parameters"],"exampleFix":"// before\nfunc (fn *mySDF) CreateTracker(rest, elem myRestriction, ctx context.Context) myTracker { ... }\n// after\nfunc (fn *mySDF) CreateTracker(rest myRestriction, elem myElem) myTracker { ... }","handlingStrategy":"validation","validationCode":"n := reflect.TypeOf(fn).NumMethod()\nm, _ := reflect.TypeOf(fn).MethodByName(\"CreateTracker\")\nif m == nil || m.Type.NumIn() < 2 || m.Type.NumIn() > 3 {\n\treturn errors.New(\"CreateTracker must take 1 or 2 parameters\")\n}","typeGuard":"func validCreateTracker(fn interface{}) bool {\n\tm, ok := reflect.TypeOf(fn).MethodByName(\"CreateTracker\")\n\treturn ok && m.Type.NumIn() >= 2 && m.Type.NumIn() <= 3\n}","tryCatchPattern":null,"preventionTips":["Keep CreateTracker signatures to the documented 1-2 parameter forms","Run pipeline construction against test data before deployment","Copy signatures only from official SDF examples"],"tags":["go","apache-beam","splittable-dofn","panic"],"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-20T03:17:13.778Z"}