apache/beam · error

not enough required parameters: %v

Error message

not enough required parameters: %v

What it means

Satisfy in sdks/go/pkg/beam/core/funcx/signature.go checks whether a function's reflect.Type has enough input and output parameters to fill a Signature's required Args and Return. This error is returned when the function has fewer Ins than sig.Args or fewer Outs than sig.Return, so the required part of the signature cannot be met. It is a static signature-mismatch error caught at registration time, not at pipeline runtime.

Source

Thrown at sdks/go/pkg/beam/core/funcx/signature.go:133

	case *Fn:
		typ = fx.Fn.Type()
	case reflectx.Func:
		typ = fx.Type()
	default:
		value := reflect.ValueOf(fn)
		if value.Kind() != reflect.Func {
			return errors.Errorf("not a function: %v", value)
		}
		typ = value.Type()
	}
	for i := 0; i < typ.NumIn(); i++ {
		in = append(in, typ.In(i))
	}
	for i := 0; i < typ.NumOut(); i++ {
		out = append(out, typ.Out(i))
	}
	if len(in) < len(sig.Args) || len(out) < len(sig.Return) {
		return errors.Errorf("not enough required parameters: %v", typ)
	}

	if len(in) > len(sig.Args)+len(sig.OptArgs) || len(out) > len(sig.Return)+len(sig.OptReturn) {
		return errors.Errorf("too many parameters: %v", typ)
	}

	// (1) Create generic binding. If inconsistent, reject fn. We do not allow
	// optional parameters to be _defining_ generic to avoid ambiguity here.

	m := make(map[string]reflect.Type)
	off := len(in) - len(sig.Args)
	if err := bind(in[off:], sig.Args, m); err != nil {
		return err
	}
	if err := bind(out[:len(sig.Return)], sig.Return, m); err != nil {
		return err
	}

View on GitHub (pinned to 12126d8942)

Solutions

  1. Add the missing input parameters or return values so the function matches sig.Args and sig.Return.
  2. Print sig (or reflect.TypeOf(fn)) and compare parameter/return counts against the required counts.
  3. If the extra parameters are truly optional, move them from sig.Args/sig.Return to sig.OptArgs/sig.OptReturn.

Example fix

// before
func add(a, b int) int { return a + b } // 1 return, signature requires (int, int) -> (int, error)
// after
func add(a, b int) (int, error) { return a + b, nil }
Defensive patterns

Strategy: validation

Validate before calling

t := reflect.TypeOf(fn)
if t.NumIn() < len(sig.Args) || t.NumOut() < len(sig.Return) {
    return fmt.Errorf("fn %v lacks required params for sig %v", t, sig)
}

Prevention

When it happens

Trigger: Calling MustSatisfy(fn, sig) or Satisfy(fn, sig) (directly or via validateEncoder/validateDecoder/validateSignature) with a function whose number of parameters is less than the number of required Args, or whose number of return values is less than the number of required Return types in sig.

Common situations: Writing a DoFn/combiner method that omits a context or error parameter the signature requires; registering an emitter or wrapper function with too few return values; refactoring a function to drop a return value while the Signature still declares two.

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