apache/beam · error
too many parameters: %v
Error message
too many parameters: %v
What it means
Satisfy returns this error when a function has more input parameters than sig.Args plus sig.OptArgs, or more return values than sig.Return plus sig.OptReturn. The signature model only allows optional parameters up to a declared maximum; anything beyond that cannot be bound and the function is rejected.
Source
Thrown at sdks/go/pkg/beam/core/funcx/signature.go:137
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
}
// (2) Check satisfiability under binding.
if err := matchReq(in[off:], sig.Args); err != nil {
return errView on GitHub (pinned to 12126d8942)
Solutions
- Remove the surplus parameters or return values from the function.
- Extend the Signature: add OptArgs/OptReturn entries (or additional required Args) to cover the extra parameters.
- Choose a different predefined Signature that matches the function's actual arity.
Example fix
// before
func fmt(x int) (int, error, string) { return x, nil, "" } // 3 returns, signature allows 2
// after
func fmt(x int) (int, error) { return x, nil } Defensive patterns
Strategy: validation
Validate before calling
t := reflect.TypeOf(fn)
if t.NumIn() > len(sig.Args)+len(sig.OptArgs) || t.NumOut() > len(sig.Return)+len(sig.OptReturn) {
return fmt.Errorf("fn %v exceeds sig %v arity", t, sig)
} Prevention
- Never add ad-hoc parameters or return values to DoFn methods without updating the Signature.
- Move auxiliary values into structs instead of extra returns.
- Review function signatures when upgrading Beam versions.
When it happens
Trigger: Calling Satisfy/MustSatisfy with a function that has extra parameters or extra return values beyond what the Signature declares (required + optional), e.g. a 3-return function validated against a 2-return signature with no OptReturn.
Common situations: Adding a debug/logging parameter or an extra return value to a DoFn method without updating the Signature; using a generic wrapper function with more outs than the framework expects; copy-pasting a function from a different signature context.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- not enough required parameters: %v
- failed to match optional parameter %v
- first main input parameter must be a value type
- inferCoder failed: interface type %v has no coder registered
- errIllegalParametersInIter
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/899af0a700e4e78a.
Report an issue: GitHub.