apache/beam · error

found params, want >

Error message

found %v params, want >%v

What it means

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.

Solutions

  1. Ensure the DoFn has one more value/iter/multimap parameter than the number of side inputs, with the main input first.
  2. 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).
  3. Remove extra beam.SideInput options that don't correspond to a DoFn parameter.

Example fix

// before: both params declared as side inputs, no main input
func (f *fn) ProcessElement(ctx context.Context, lookup func(string) bool) error

// after: main input first, side input last
func (f *fn) ProcessElement(ctx context.Context, elm string, lookup func(string) bool) error
Defensive patterns

Strategy: validation

Validate before calling

params := countValueLikeParams(fn) // value/iter/reiter/multimap params
sideParams := countSideInputParams(fn)
if params <= sideParams {
    return fmt.Errorf("DoFn %T needs at least %d main-input params, found %d", fn, sideParams+1, params)
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

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/f51123a6786feadc. Report an issue: GitHub.

Appendix: source

Thrown at sdks/go/pkg/beam/core/runtime/exec/fn.go:455

	}
	if r3 == nil {
		panic(fmt.Sprintf("invoker.ret5: cannot return a nil process continuation from function %v", n.fn))
	}
	n.ret = FullValue{Windows: ws, Timestamp: r0.(typex.EventTime), Elm: r1, Elm2: r2, Continuation: r3.(sdf.ProcessContinuation)}
	return &n.ret, nil
}

func makeSideInputs(ctx context.Context, w typex.Window, side []SideInputAdapter, reader StateReader, fn *funcx.Fn, in []*graph.Inbound) ([]ReusableInput, error) {
	if len(side) == 0 {
		return nil, nil // ok: no side input
	}

	if len(in) != len(side)+1 {
		return nil, errors.Errorf("found %v inbound, want %v", len(in), len(side)+1)
	}
	param := fn.Params(funcx.FnValue | funcx.FnIter | funcx.FnReIter | funcx.FnMultiMap)
	if len(param) <= len(side) {
		return nil, errors.Errorf("found %v params, want >%v", len(param), len(side))
	}

	// The side input are last of the above params, so we can compute the offset easily.
	offset := len(param) - len(side)

	var ret []ReusableInput
	for i, adapter := range side {
		inKind := in[i+1].Kind
		params := fn.Param[param[i+offset]].T
		// Handle MultiMaps separately since they require more/different information
		// than the other side inputs
		if inKind == graph.MultiMap {
			s := makeMultiMap(ctx, params, side[i], reader, w)
			ret = append(ret, s)
			continue
		}
		stream, err := adapter.NewIterable(ctx, reader, w)
		if err != nil {

View on GitHub (pinned to 12126d8942)