apache/beam · error
too few inputs: forgot an input or to annotate options?
Error message
too few inputs: forgot an input or to annotate options?
What it means
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.
Source
Thrown at sdks/go/pkg/beam/core/graph/bind.go:164
arity, err := inboundArity(input, index == 0)
if err != nil {
return nil, nil, addContext(err, params, input)
}
if len(params)-index < arity {
return nil, nil, addContext(errors.New("too few params"), params[index:], input)
}
paramsToBind := params[index : index+arity]
elm, kind, err := tryBindInbound(input, paramsToBind, index == 0)
if err != nil {
return nil, nil, addContext(err, paramsToBind, input)
}
inbound = append(inbound, elm)
kinds = append(kinds, kind)
index += arity
}
if index < len(params) {
return nil, nil, addContext(errors.New("too few inputs: forgot an input or to annotate options?"), params, in)
}
if index > len(params) {
return nil, nil, addContext(errors.New("too many inputs"), params, in)
}
return inbound, kinds, nil
}
func tryBindInbound(t typex.FullType, args []funcx.FnParam, isMain bool) (typex.FullType, InputKind, error) {
kind := Main
var other typex.FullType
switch t.Class() {
case typex.Concrete, typex.Container:
if isMain {
other = typex.New(args[0].T)
} else {
// We accept various forms for side input. We have to disambiguate
// []string into a Singleton of type []string or a Slice of typeView on GitHub (pinned to 12126d8942)
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.
Example fix
// before
func (fn *f) ProcessElement(v int) {} // called with 2 inputs
// after
func (fn *f) ProcessElement(w string, v int) {} Defensive patterns
Strategy: validation
Validate before calling
// Ensure number of supplied inputs does not exceed function inbound arity
if suppliedInputs > declaredInboundArity(fn) {
return fmt.Errorf("too many inputs for %s: %d supplied, %d declared", fnName, suppliedInputs, declaredInboundArity(fn))
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- too few params
- too many inputs
- needs at least 1 input
- node %v in graph has undefined coder
- node %v in graph is unconnected
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/c629e81c1b1b8fc1.
Report an issue: GitHub.