{"record":{"id":"01a4576f66a09d0b","repo":"apache/beam","slug":"combine-does-not-support-side-inputs","errorCode":null,"errorMessage":"combine does not support side inputs","messagePattern":"combine does not support side inputs","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/combine.go","lineNumber":65,"sourceCode":"\treturn DropKey(s, post), nil\n}\n\nfunc addCombinePerKeyCtx(err error, s Scope) error {\n\treturn errors.WithContextf(err, \"inserting CombinePerKey in scope %s\", s)\n}\n\n// TryCombinePerKey attempts to insert a per-key Combine transform into the pipeline. It may fail\n// for multiple reasons, notably that the combinefn is not valid or cannot be bound\n// -- due to type mismatch, say -- to the incoming PCollection.\nfunc TryCombinePerKey(s Scope, combinefn any, col PCollection, opts ...Option) (PCollection, error) {\n\ts = s.Scope(graph.CombinePerKeyScope)\n\tValidateKVType(col)\n\tside, typedefs, err := validate(s, col, opts)\n\tif err != nil {\n\t\treturn PCollection{}, addCombinePerKeyCtx(err, s)\n\t}\n\tif len(side) > 0 {\n\t\treturn PCollection{}, addCombinePerKeyCtx(errors.New(\"combine does not support side inputs\"), s)\n\t}\n\n\tcol, err = TryGroupByKey(s, col)\n\tif err != nil {\n\t\treturn PCollection{}, addCombinePerKeyCtx(err, s)\n\t}\n\n\tfn, err := graph.NewCombineFn(combinefn)\n\tif err != nil {\n\t\treturn PCollection{}, addCombinePerKeyCtx(err, s)\n\t}\n\t// This seems like the best place to infer the accumulator coder type, unless\n\t// it's a universal type.\n\t// We can get the fulltype from the return value of the mergeAccumulatorFn\n\t// TODO(lostluck): 2018/05/28 Correctly infer universal type coder if necessary.\n\taccumCoder, err := inferCoder(typex.New(fn.MergeAccumulatorsFn().Ret[0].T))\n\tif err != nil {\n\t\twrapped := errors.Wrap(err, \"unable to infer CombineFn accumulator coder\")","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/combine.go#L47-L83","documentation":"beam.TryCombinePerKey validates its options and rejects any side inputs: the Go Combine transform does not implement side-input consumption. If validate() reports side inputs among opts, it returns this error wrapped with addCombinePerKeyCtx.","triggerScenarios":"Calling beam.CombinePerKey/TryCombinePerKey with a SideInput options (beam.SideInput from a side PCollections list), e.g. beam.CombinePerKey(fn, beam.SideInput{Input: otherCol}).","commonSituations":"Porting a Python/Java combine-with-sides pattern to Go, or copying a combine Fn signature that takes an iter side input.","solutions":["Remove the SideInput option; do the combine on the main input only.","Pre-join the side data into the main PCollection (CoGroupByKey or side-input via beam.ParDo) before combining.","Broadcast small side data as a singleton view and read it inside the Fn via an emulated mechanism, or restructure as a GroupByKey + custom ParDo."],"exampleFix":"// before\nbeam.CombinePerKey(s, fn, beam.SideInput{Input: dims})\n// after\nbeam.CombinePerKey(s, fn) // join dims separately via CoGroupByKey","handlingStrategy":"validation","validationCode":"for _, o := range opts {\n\tif _, ok := o.(beam.SideInput); ok {\n\t\treturn errors.New(\"CombinePerKey does not accept SideInput options; pre-join instead\")\n\t}\n}","typeGuard":null,"tryCatchPattern":"col, err := beam.TryCombinePerKey(s, col, opts...)\nif err != nil && strings.Contains(err.Error(), \"does not support side inputs\") {\n\t// restructure with CoGroupByKey\n}","preventionTips":["Never pass beam.SideInput options to CombinePerKey/TryCombine in Go.","Plan joins before combines: pre-enrich the main input with side data via CoGroupByKey.","Check the Go SDK docs — side-input combine is unsupported (unlike Python/Java)."],"tags":["go","apache-beam","combine","side-input"],"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"}