{"record":{"id":"c629e81c1b1b8fc1","repo":"apache/beam","slug":"too-few-inputs-forgot-an-input-or-to-annotate-options","errorCode":null,"errorMessage":"too few inputs: forgot an input or to annotate options?","messagePattern":"too few inputs: forgot an input or to annotate options\\?","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/graph/bind.go","lineNumber":164,"sourceCode":"\t\tarity, err := inboundArity(input, index == 0)\n\t\tif err != nil {\n\t\t\treturn nil, nil, addContext(err, params, input)\n\t\t}\n\t\tif len(params)-index < arity {\n\t\t\treturn nil, nil, addContext(errors.New(\"too few params\"), params[index:], input)\n\t\t}\n\n\t\tparamsToBind := params[index : index+arity]\n\t\telm, kind, err := tryBindInbound(input, paramsToBind, index == 0)\n\t\tif err != nil {\n\t\t\treturn nil, nil, addContext(err, paramsToBind, input)\n\t\t}\n\t\tinbound = append(inbound, elm)\n\t\tkinds = append(kinds, kind)\n\t\tindex += arity\n\t}\n\tif index < len(params) {\n\t\treturn nil, nil, addContext(errors.New(\"too few inputs: forgot an input or to annotate options?\"), params, in)\n\t}\n\tif index > len(params) {\n\t\treturn nil, nil, addContext(errors.New(\"too many inputs\"), params, in)\n\t}\n\treturn inbound, kinds, nil\n}\n\nfunc tryBindInbound(t typex.FullType, args []funcx.FnParam, isMain bool) (typex.FullType, InputKind, error) {\n\tkind := Main\n\tvar other typex.FullType\n\n\tswitch t.Class() {\n\tcase typex.Concrete, typex.Container:\n\t\tif isMain {\n\t\t\tother = typex.New(args[0].T)\n\t\t} else {\n\t\t\t// We accept various forms for side input. We have to disambiguate\n\t\t\t// []string into a Singleton of type []string or a Slice of type","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/graph/bind.go#L146-L182","documentation":"Bind/findInbound finished assigning parameters to the function's declared inputs but unconsumed parameters remain (index < len(params)). The function's inbound signature accounts for fewer inputs than were supplied — typically a missing main input or un-annotated option/emitter in the DoFn signature.","triggerScenarios":"Supplying more arguments (PCollections, side inputs) to a transform than the DoFn/combiner signature declares, e.g. passing two PCollections to a ParDo whose ProcessElement takes only one element and no extra input.","commonSituations":"Reusing a DoFn across pipelines after adding an input PCollection, mismatched Zip/CoGBK output usage, or forgetting the `beam.Scan`/option annotation for variadic trailing inputs.","solutions":["Add a parameter to the DoFn/combine signature to consume the extra input, or annotate it (e.g. as an option/emitter) if that is intended.","Remove the surplus argument at the transform call site.","Verify input ordering: main inputs must come first, then side inputs.","Run the pipeline with beam.Try* variants to surface signature mismatches with types."],"exampleFix":"// before\nfunc (fn *f) ProcessElement(v int) {}  // called with 2 inputs\n// after\nfunc (fn *f) ProcessElement(w string, v int) {}","handlingStrategy":"validation","validationCode":"// Ensure number of supplied inputs does not exceed function inbound arity\nif suppliedInputs > declaredInboundArity(fn) {\n    return fmt.Errorf(\"too many inputs for %s: %d supplied, %d declared\", fnName, suppliedInputs, declaredInboundArity(fn))\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep transform call sites and DoFn signatures in sync; update both together in refactors.","Review transform calls after copying code between pipelines.","Annotate extra trailing inputs (options/emitters) explicitly in the signature."],"tags":["go","beam","graph","arity-mismatch"],"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-14T16:17:12.679Z"}