{"record":{"id":"f51123a6786feadc","repo":"apache/beam","slug":"found-v-params-want-v","errorCode":null,"errorMessage":"found %v params, want >%v","messagePattern":"found (.+?) params, want >(.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/runtime/exec/fn.go","lineNumber":455,"sourceCode":"\t}\n\tif r3 == nil {\n\t\tpanic(fmt.Sprintf(\"invoker.ret5: cannot return a nil process continuation from function %v\", n.fn))\n\t}\n\tn.ret = FullValue{Windows: ws, Timestamp: r0.(typex.EventTime), Elm: r1, Elm2: r2, Continuation: r3.(sdf.ProcessContinuation)}\n\treturn &n.ret, nil\n}\n\nfunc makeSideInputs(ctx context.Context, w typex.Window, side []SideInputAdapter, reader StateReader, fn *funcx.Fn, in []*graph.Inbound) ([]ReusableInput, error) {\n\tif len(side) == 0 {\n\t\treturn nil, nil // ok: no side input\n\t}\n\n\tif len(in) != len(side)+1 {\n\t\treturn nil, errors.Errorf(\"found %v inbound, want %v\", len(in), len(side)+1)\n\t}\n\tparam := fn.Params(funcx.FnValue | funcx.FnIter | funcx.FnReIter | funcx.FnMultiMap)\n\tif len(param) <= len(side) {\n\t\treturn nil, errors.Errorf(\"found %v params, want >%v\", len(param), len(side))\n\t}\n\n\t// The side input are last of the above params, so we can compute the offset easily.\n\toffset := len(param) - len(side)\n\n\tvar ret []ReusableInput\n\tfor i, adapter := range side {\n\t\tinKind := in[i+1].Kind\n\t\tparams := fn.Param[param[i+offset]].T\n\t\t// Handle MultiMaps separately since they require more/different information\n\t\t// than the other side inputs\n\t\tif inKind == graph.MultiMap {\n\t\t\ts := makeMultiMap(ctx, params, side[i], reader, w)\n\t\t\tret = append(ret, s)\n\t\t\tcontinue\n\t\t}\n\t\tstream, err := adapter.NewIterable(ctx, reader, w)\n\t\tif err != nil {","sourceCodeStart":437,"sourceCodeEnd":473,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/exec/fn.go#L437-L473","documentation":"makeSideInputs checks that the DoFn has strictly more parameters matching value/iter/reiter/multimap kinds than there are side inputs, because side inputs occupy the trailing parameters and at least one main-input parameter must remain. If len(param) <= len(side), there is no main input parameter left, so the library fails with this message.","triggerScenarios":"initSideInput -> makeSideInputs where fn.Params(FnValue|FnIter|FnReIter|FnMultiMap) returns a count less than or equal to the number of declared side inputs, e.g. a DoFn whose only matchable param is consumed as a side input, or a side input declared for a param that isn't a value/iter kind.","commonSituations":"Writing a DoFn with a side input parameter typed incorrectly (e.g. a plain func param instead of func(T) bool iterator style), so beam's param extraction counts too few; declaring more beam.SideInput options than value-consuming parameters; typo in the DoFn so beam cannot recognize the main input parameter.","solutions":["Ensure the DoFn has one more value/iter/multimap parameter than the number of side inputs, with the main input first.","Fix parameter types so beam recognizes them (e.g. main input as T or func(T) bool, side inputs as func(T) bool / map readers).","Remove extra beam.SideInput options that don't correspond to a DoFn parameter."],"exampleFix":"// before: both params declared as side inputs, no main input\nfunc (f *fn) ProcessElement(ctx context.Context, lookup func(string) bool) error\n\n// after: main input first, side input last\nfunc (f *fn) ProcessElement(ctx context.Context, elm string, lookup func(string) bool) error","handlingStrategy":"validation","validationCode":"params := countValueLikeParams(fn) // value/iter/reiter/multimap params\nsideParams := countSideInputParams(fn)\nif params <= sideParams {\n    return fmt.Errorf(\"DoFn %T needs at least %d main-input params, found %d\", fn, sideParams+1, params)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always put the main input parameter first in DoFn signatures.","Type side inputs as func(T) bool, ReStream, or multimap readers so beam recognizes them.","Run beam's unit-test harness (ptest) to catch signature errors early."],"tags":["go","apache-beam","dofn-signature","side-input"],"backgroundTag":"missing-required-argument","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"}