apache/beam · error

too few params

Error message

too few params

What it means

During graph construction, Bind/findInbound matches supplied runtime parameters (inputs, side inputs, options) to the function's declared inbound arity. This error means the list of parameters ran out: a remaining input requires `arity` params but fewer than that remain, so the function call cannot be fully bound.

Source

Thrown at sdks/go/pkg/beam/core/graph/bind.go:151

}

func findInbound(fn *funcx.Fn, in ...typex.FullType) ([]typex.FullType, []InputKind, error) {
	// log.Printf("Bind inbound: %v %v", fn, in)
	addContext := func(err error, p []funcx.FnParam, in any) error {
		return errors.WithContextf(err, "binding params %v to input %v", p, in)
	}

	var inbound []typex.FullType
	var kinds []InputKind
	params := funcx.SubParams(fn.Param, fn.Params(funcx.FnValue|funcx.FnIter|funcx.FnReIter|funcx.FnMultiMap)...)
	index := 0
	for _, input := range in {
		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

View on GitHub (pinned to 12126d8942)

Solutions

  1. Pass all required inputs to the transform in signature order (main element first, then side inputs, then options).
  2. Compare the DoFn ProcessElement signature arity with the arguments supplied at the beam.ParDo/beam.TryParDo call site.
  3. If the extra input is a side input, wrap it with beam.SideInput(pcoll) and pass it in the right position.
  4. Use beam.TryParDo to get a clearer typed error during development.

Example fix

// before
beam.ParDo(s, &myFn{}, in)          // myFn needs a side input
// after
beam.ParDo(s, &myFn{}, in, beam.SideInput{Input: side})
Defensive patterns

Strategy: validation

Validate before calling

// Count main + side input params of the DoFn and compare with args before binding
if len(args) < requiredArity(dofn) {
    return fmt.Errorf("%s requires %d inputs, got %d", dofnName, requiredArity(dofn), len(args))
}

Prevention

When it happens

Trigger: Calling beam.ParDo/beam.Combine/etc. with a DoFn or function whose signature requires more main/side inputs than were passed — e.g. a DoFn with ProcessElement(ctx, element, sideInput) bound with only two arguments, or forgetting a side-input argument.

Common situations: Forgetting to pass a side input created with beam.SideInput, omitting the emitter/emitter-out argument order mismatch, or changing a DoFn signature without updating the transform call site.

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


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/54c2bc5af6093ade. Report an issue: GitHub.