{"record":{"id":"46aeb932aa3241ce","repo":"apache/beam","slug":"errillegalparametersinmultimap","errorCode":null,"errorMessage":"errIllegalParametersInMultiMap","messagePattern":"errIllegalParametersInMultiMap","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/funcx/sideinput.go","lineNumber":188,"sourceCode":"\n// UnfoldMultiMap returns the parameter types for the input key and the output\n// values iff the type is a keyed functional iterator generator.\nfunc UnfoldMultiMap(t reflect.Type) ([]reflect.Type, bool) {\n\ttypes, ok, _ := unfoldMultiMap(t)\n\treturn types, ok\n}\n\nfunc unfoldMultiMap(t reflect.Type) ([]reflect.Type, bool, error) {\n\tif t.Kind() != reflect.Func {\n\t\treturn nil, false, nil\n\t}\n\tif t.NumIn() != 1 || t.NumOut() != 1 {\n\t\treturn nil, false, nil\n\t}\n\ttypes := []reflect.Type{t.In(0)}\n\titerTypes, is, err := unfoldIter(t.Out(0))\n\ttypes = append(types, iterTypes...)\n\treturn types, is, errors.Wrap(err, errIllegalParametersInMultiMap)\n}\n","sourceCodeStart":170,"sourceCodeEnd":190,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/funcx/sideinput.go#L170-L190","documentation":"unfoldMultiMap in sdks/go/pkg/beam/core/funcx/sideinput.go validates keyed multimap iterator functions, which must take exactly 1 input (the key) and return exactly 1 output that is itself a valid iterator generator. The output is validated via unfoldIter and any resulting error is wrapped with errIllegalParametersInMultiMap. The library throws it to attribute the signature failure to the multimap function.","triggerScenarios":"Providing a multimap function like `func(k string) *int` (output is not an iterator generator) or `func(k string) func(v int) bool` where the inner value parameter is not a pointer, causing the wrapped unfoldIter error.","commonSituations":"Using PCollectionView<KV<K, Iterable<V>>>-style side inputs in Go and mis-declaring the accessor function; forgetting the pointer on the value parameter of the inner iterator; giving the function zero or multiple key parameters.","solutions":["Use the exact shape `func(k K) func(*V) bool` with exactly one key input and one iterator-generator output.","Fix the inner iterator parameters (pointer to a valid PCollection element type) since the wrapped error originates in unfoldIter.","Confirm the signature with fx.IsMultiMap / fx.IsMalformedMultiMap in a test."],"exampleFix":"// before\nmm := func(k string) *int { ... }\n// after\nmm := func(k string) func(*int) bool {\n\tvals := ... // values for key k\n\treturn func(v *int) bool { ... }\n}","handlingStrategy":"validation","validationCode":"func checkMultiMap(fn interface{}) error {\n\tt := reflect.TypeOf(fn)\n\tif t == nil || t.Kind() != reflect.Func {\n\t\treturn fmt.Errorf(\"not a func: %T\", fn)\n\t}\n\tif t.NumIn() != 1 || t.NumOut() != 1 {\n\t\treturn fmt.Errorf(\"multimap must have 1 in, 1 out; got %d in, %d out\", t.NumIn(), t.NumOut())\n\t}\n\tout := t.Out(0)\n\tif out.Kind() != reflect.Func {\n\t\treturn fmt.Errorf(\"multimap output must be a func, got %v\", out)\n\t}\n\tfor i := 0; i < out.NumIn(); i++ {\n\t\tif out.In(i).Kind() != reflect.Ptr {\n\t\t\treturn fmt.Errorf(\"inner value param %d must be a pointer\", i)\n\t\t}\n\t}\n\treturn nil\n}","typeGuard":"func isMultiMapShape(t reflect.Type) bool {\n\treturn t != nil && t.Kind() == reflect.Func && t.NumIn() == 1 && t.NumOut() == 1 && t.Out(0).Kind() == reflect.Func\n}","tryCatchPattern":"if _, ok, err := fx.UnfoldMultiMap(fn); err != nil {\n\t// err wraps errIllegalParametersInMultiMap\n\treturn fmt.Errorf(\"bad multimap signature: %w\", err)\n}","preventionTips":["Use the canonical shape `func(k K) func(*V) bool` for keyed multimap side inputs.","Exactly one key parameter — no context or extra params.","Validate with fx.IsMultiMap in unit tests alongside your DoFn tests."],"tags":["go","beam","multimap","side-input","function-signature"],"backgroundTag":"invalid-argument-value","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}