{"record":{"id":"69f5dd986d905134","repo":"apache/beam","slug":"not-enough-required-parameters-v","errorCode":null,"errorMessage":"not enough required parameters: %v","messagePattern":"not enough required parameters: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/funcx/signature.go","lineNumber":133,"sourceCode":"\tcase *Fn:\n\t\ttyp = fx.Fn.Type()\n\tcase reflectx.Func:\n\t\ttyp = fx.Type()\n\tdefault:\n\t\tvalue := reflect.ValueOf(fn)\n\t\tif value.Kind() != reflect.Func {\n\t\t\treturn errors.Errorf(\"not a function: %v\", value)\n\t\t}\n\t\ttyp = value.Type()\n\t}\n\tfor i := 0; i < typ.NumIn(); i++ {\n\t\tin = append(in, typ.In(i))\n\t}\n\tfor i := 0; i < typ.NumOut(); i++ {\n\t\tout = append(out, typ.Out(i))\n\t}\n\tif len(in) < len(sig.Args) || len(out) < len(sig.Return) {\n\t\treturn errors.Errorf(\"not enough required parameters: %v\", typ)\n\t}\n\n\tif len(in) > len(sig.Args)+len(sig.OptArgs) || len(out) > len(sig.Return)+len(sig.OptReturn) {\n\t\treturn errors.Errorf(\"too many parameters: %v\", typ)\n\t}\n\n\t// (1) Create generic binding. If inconsistent, reject fn. We do not allow\n\t// optional parameters to be _defining_ generic to avoid ambiguity here.\n\n\tm := make(map[string]reflect.Type)\n\toff := len(in) - len(sig.Args)\n\tif err := bind(in[off:], sig.Args, m); err != nil {\n\t\treturn err\n\t}\n\tif err := bind(out[:len(sig.Return)], sig.Return, m); err != nil {\n\t\treturn err\n\t}\n","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/funcx/signature.go#L115-L151","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Add the missing input parameters or return values so the function matches sig.Args and sig.Return.","Print sig (or reflect.TypeOf(fn)) and compare parameter/return counts against the required counts.","If the extra parameters are truly optional, move them from sig.Args/sig.Return to sig.OptArgs/sig.OptReturn."],"exampleFix":"// before\nfunc add(a, b int) int { return a + b } // 1 return, signature requires (int, int) -> (int, error)\n// after\nfunc add(a, b int) (int, error) { return a + b, nil }","handlingStrategy":"validation","validationCode":"t := reflect.TypeOf(fn)\nif t.NumIn() < len(sig.Args) || t.NumOut() < len(sig.Return) {\n    return fmt.Errorf(\"fn %v lacks required params for sig %v\", t, sig)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Count parameters and returns against the Signature before registering a function.","Use MustSatisfy in unit tests to catch arity errors at test time.","Keep DoFn process methods close to documented signature examples."],"tags":["go","beam","signature-validation","reflection"],"backgroundTag":"missing-required-argument","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}