{"record":{"id":"62015cf51e05dc2d","repo":"apache/beam","slug":"wanted-one-key-value-got-v","errorCode":null,"errorMessage":"wanted one key value, got %v","messagePattern":"wanted one key value, got (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/runtime/exec/input.go","lineNumber":235,"sourceCode":"\tmm.fn = reflect.MakeFunc(t, mm.invoke).Interface()\n\treturn mm\n}\n\nfunc (v *multiMapValue) Init() error {\n\treturn nil\n}\n\nfunc (v *multiMapValue) Value() any {\n\treturn v.fn\n}\n\nfunc (v *multiMapValue) Reset() error {\n\treturn nil\n}\n\nfunc (v *multiMapValue) invoke(args []reflect.Value) []reflect.Value {\n\tif len(args) != 1 {\n\t\tpanic(fmt.Sprintf(\"wanted one key value, got %v\", args))\n\t}\n\trs, err := v.adapter.NewKeyedIterable(v.ctx, v.reader, v.w, args[0].Interface())\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"failed to create keyed iterable, got %v\", err))\n\t}\n\titer := makeIter(v.t.Out(0), rs)\n\titer.Init()\n\treturn []reflect.Value{reflect.ValueOf(iter.Value())}\n}\n","sourceCodeStart":217,"sourceCodeEnd":245,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/exec/input.go#L217-L245","documentation":"multiMapValue.invoke is the reflect-made function backing a multimap side input; user code calls it with the key to obtain a keyed iterable. It expects exactly one argument (the key). If reflection hands it any other number of arguments it panics with 'wanted one key value, got ...'. This indicates a mismatch between the declared multimap function type and how it is being invoked.","triggerScenarios":"The multimap value's reflect function type (v.t) does not take exactly one input parameter, so user-code invocation or plan wiring calls it with 0 or 2+ arguments — typically caused by an illegal multimap type that slipped past UnfoldMultiMap or a mismatched DoFn signature.","commonSituations":"DoFn signature where the side-input parameter is a multi-argument function; incompatible SDK versions between graph construction and execution; hand-built reflection types for testing.","solutions":["Ensure the multimap function type has exactly one input parameter (the key).","Fix the DoFn signature so the side input parameter matches beam's multimap convention.","Check that graph serialization/execution use the same SDK version so types are decoded consistently."],"exampleFix":"// before\nfunc (fn *f) ProcessElement(k string, v int, iter func(*int) bool) // wrong arity at call site\n// after\nfunc (fn *f) ProcessElement(k string, iter func(*int) bool) // exactly one key arg for the multimap fn","handlingStrategy":"validation","validationCode":"// Confirm the multimap function type takes exactly one key argument:\nif fnType.Kind() == reflect.Func && fnType.NumIn() != 1 {\n\treturn fmt.Errorf(\"multimap fn must take exactly 1 key arg, has %d\", fnType.NumIn())\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use the standard DoFn multimap signature: func(key K, iter func(*V) bool).","Keep graph-producer and runner SDK versions aligned.","Avoid hand-written reflect types for side inputs in tests.","Check DoFn parameter order and arity during code review."],"tags":["go","apache-beam","side-input","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-20T03:17:13.778Z"}