{"record":{"id":"b4851564ceda1f48","repo":"apache/beam","slug":"illegal-multimap-type-v","errorCode":null,"errorMessage":"illegal multimap type: %v","messagePattern":"illegal multimap type: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/runtime/exec/input.go","lineNumber":214,"sourceCode":"\treturn nil\n}\n\ntype multiMapValue struct {\n\tt       reflect.Type\n\tkeyType reflect.Type\n\t// These four things are needed to dynamically build the iterables\n\tctx     context.Context\n\tadapter SideInputAdapter\n\treader  StateReader\n\tw       typex.Window\n\t// fn is the actual invoked function\n\tfn any\n}\n\nfunc makeMultiMap(ctx context.Context, t reflect.Type, adapter SideInputAdapter, reader StateReader, w typex.Window) ReusableInput {\n\ttypes, ok := funcx.UnfoldMultiMap(t)\n\tif !ok {\n\t\tpanic(fmt.Sprintf(\"illegal multimap type: %v\", t))\n\t}\n\tmm := &multiMapValue{t: t, keyType: types[0], ctx: ctx, adapter: adapter, reader: reader, w: w}\n\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","sourceCodeStart":196,"sourceCodeEnd":232,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/exec/input.go#L196-L232","documentation":"makeMultiMap builds a reflect function exposing a multimap side input (func(key K) func(*V) bool style). It validates the Go type by unfolding it with funcx.UnfoldMultiMap; if the type does not match the expected multimap shape, it panics with 'illegal multimap type'. This is a wiring-time type validation, so the pipeline fails during plan construction, not during element processing.","triggerScenarios":"A DoFn parameter or graph edge typed as a multimap side input has a signature UnfoldMultiMap cannot decompose — e.g. wrong number of type parameters, a map instead of an iterable-returning function, or mismatched key/value types when makeSideInputs wires the side input.","commonSituations":"Mistyped DoFn signature (e.g. func(string, func(int) bool) vs expected single-arg form); passing a KV map type where an iterable factory is expected; changes to the side input declaration (beam.SideInput of PCollection<KV>) that no longer match.","solutions":["Check the DoFn parameter type: a multimap side input must be a function from key type to an iterator function, e.g. func(key K, iter func(*V) bool) or matching beam's expected multimap shape.","Verify the side input PCollection is a KV (PCollection<KV<K,V>>), not a plain PCollection.","Recreate the side input with beam.SideInput and confirm the emitted element type matches the DoFn's expectation.","Print the reflect type in the panic (it is included) and compare against the expected funcx.UnfoldMultiMap shape."],"exampleFix":"// before\nfunc (fn *f) ProcessElement(m map[string]int) { ... } // illegal multimap type\n// after\nfunc (fn *f) ProcessElement(key string, iter func(*int) bool) { ... } // valid multimap access via side input","handlingStrategy":"validation","validationCode":"// Validate the DoFn's multimap side-input type shape before submitting:\nfunc isMultiMapFn(t reflect.Type) bool {\n\tif t.Kind() != reflect.Func || t.NumIn() != 1 || t.NumOut() != 1 {\n\t\treturn false\n\t}\n\tout := t.Out(0)\n\treturn out.Kind() == reflect.Func && out.NumIn() == 1 && out.NumOut() == 2\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Declare multimap side inputs as KV PCollections passed via beam.SideInput.","Match the DoFn signature exactly to the multimap convention (key + iterator function).","Verify the side input element type with typex checks before expansion.","Test side-input pipelines at small scale before production submission."],"tags":["go","apache-beam","side-input","type-error"],"backgroundTag":"invalid-argument-format","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"}