{"record":{"id":"36445b314b06efa8","repo":"apache/beam","slug":"type-interface-isn-t-a-supported-pcollection-type-sideinput","errorCode":null,"errorMessage":"Type interface{} isn't a supported PCollection type","messagePattern":"Type interface(.+?) isn't a supported PCollection type","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/funcx/sideinput.go","lineNumber":95,"sourceCode":"\tif t.NumIn() == 0 {\n\t\treturn nil, false, nil\n\t}\n\n\tvar ret []reflect.Type\n\tskip := 0\n\tif t.In(0).Kind() == reflect.Ptr && t.In(0).Elem() == typex.EventTimeType {\n\t\treturn nil, false, errors.New(errIllegalEventTimeInIter)\n\t}\n\tif t.NumIn()-skip > 2 || t.NumIn() == skip {\n\t\treturn nil, false, nil\n\t}\n\n\tfor i := skip; i < t.NumIn(); i++ {\n\t\tif ok, err := isOutParam(t.In(i)); !ok {\n\t\t\treturn nil, false, errors.Wrap(err, errIllegalParametersInIter)\n\t\t}\n\t\tif reflect.TypeOf((*any)(nil)).Elem() == t.In(i).Elem() && !typex.IsUniversal(t.In(i)) {\n\t\t\treturn nil, false, errors.New(\"Type interface{} isn't a supported PCollection type\")\n\t\t}\n\t\tret = append(ret, t.In(i).Elem())\n\t}\n\treturn ret, true, nil\n}\n\nfunc isOutParam(t reflect.Type) (bool, error) {\n\tif t.Kind() != reflect.Ptr {\n\t\treturn false, errors.Errorf(\"Type %v of kind %v not allowed, must be ptr type\", t, t.Kind())\n\t}\n\tif typex.IsUniversal(t.Elem()) || typex.IsContainer(t.Elem()) {\n\t\treturn true, nil\n\t}\n\treturn typex.CheckConcrete(t.Elem())\n}\n\n// IsReIter returns true iff the supplied type is a functional iterator generator.\n//","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/funcx/sideinput.go#L77-L113","documentation":"Like error 4410 but for side-input iterator/map parameters: unfoldIter in sideinput.go rejects iterator function signatures whose element type (the `In(i)` pointer's Elem) is `interface{}`/`any` and not universal. Beam requires concrete coder-encodable element types for side inputs.","triggerScenarios":"Declaring a side input iterator like `func(iter *func(v any) bool)` or a multi-map side input whose value type is `any` without a universal type annotation, when the DoFn is validated via IsIter/UnfoldIter.","commonSituations":"Generic container refactors that replaced concrete types with `any`, or writing helper functions accepting `interface{}` iterators for side inputs in custom pipeline utilities.","solutions":["Change the iterator element type from `any` to the concrete PCollection element type.","Use a universal type annotation (typex.IsUniversal-recognized) if genuinely type-erased behavior is needed.","Let Beam infer side input types from the concrete PCollection instead of hand-writing `any` signatures.","Review the DoFn method signature at the failing unfoldIter call site and tighten its types."],"exampleFix":"// before\nfunc (fn *f) ProcessElement(w string, i *func(any) bool) {}\n// after\nfunc (fn *f) ProcessElement(w string, i *func(int) bool) {}","handlingStrategy":"validation","validationCode":"func sideIterElemIsAny(fn reflect.Type) bool {\n    anyT := reflect.TypeOf((*any)(nil)).Elem()\n    for i := 0; i < fn.NumIn(); i++ {\n        p := fn.In(i)\n        if p.Kind() == reflect.Ptr && p.Elem().Kind() == reflect.Func && p.Elem().NumIn() > 0 && p.Elem().In(0) == anyT {\n            return true\n        }\n    }\n    return false\n}","typeGuard":"func isConcreteElem(t reflect.Type) bool { return t.Kind() == reflect.Ptr && t.Elem() != reflect.TypeOf((*any)(nil)).Elem() }","tryCatchPattern":null,"preventionTips":["Keep side-input iterator element types concrete.","Let beam.SideInput{Input: pcoll} inference drive types rather than hand-written `any`.","Lint DoFn signatures for `interface{}` usage in beam packages."],"tags":["go","beam","side-input","type-system"],"backgroundTag":"unsupported-operation","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"}