{"record":{"id":"78a329055d816d90","repo":"apache/beam","slug":"invalid-side-pcollection-index-v","errorCode":null,"errorMessage":"invalid side pcollection: index %v","messagePattern":"invalid side pcollection: index (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/validate.go","lineNumber":57,"sourceCode":"\tt := col.Type()\n\tif typex.IsComposite(t.Type()) {\n\t\tpanic(fmt.Sprintf(\"pcollection must be of non-composite type: %v\", col))\n\t}\n\treturn t\n}\n\n// validate validates and processes the input collection and options. Private convenience\n// function.\nfunc validate(s Scope, col PCollection, opts []Option) ([]SideInput, map[string]reflect.Type, error) {\n\tif !s.IsValid() {\n\t\treturn nil, nil, errors.New(\"invalid scope\")\n\t}\n\tif !col.IsValid() {\n\t\treturn nil, nil, errors.New(\"invalid main pcollection\")\n\t}\n\tside, defs := parseOpts(opts)\n\tfor i, in := range side {\n\t\tif !in.Input.IsValid() {\n\t\t\treturn nil, nil, errors.Errorf(\"invalid side pcollection: index %v\", i)\n\t\t}\n\t}\n\ttypedefs, err := makeTypedefs(defs)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\treturn side, typedefs, nil\n}\n\nfunc makeTypedefs(list []TypeDefinition) (map[string]reflect.Type, error) {\n\ttypedefs := make(map[string]reflect.Type)\n\tfor _, v := range list {\n\t\tif !typex.IsUniversal(v.Var) {\n\t\t\treturn nil, errors.Errorf(\"type var %s must be a universal type\", v.Var)\n\t\t}\n\t\tif ok, err := typex.CheckConcrete(v.T); !ok {\n\t\t\treturn nil, errors.Wrapf(err, \"type value %s must be a concrete type\", v.T)","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/validate.go#L39-L75","documentation":"validate() checks every side input passed via beam.SideInput options to TryParDo / TryCombinePerKey. This error reports that the PCollection attached as side input at the given index is invalid (the zero PCollection), so the transform cannot wire the side-input edge in the pipeline graph. The %v placeholder carries the zero-based index of the offending side input.","triggerScenarios":"beam.TryParDo(s, dofn, main, beam.SideInput{Input: badCol}) where badCol is a zero PCollection — from an ignored earlier Try-transform error or an unassigned variable; the formatted message reads e.g. 'invalid side pcollection: index 0'.","commonSituations":"Building side inputs in a loop where one source fails silently; mixing up slice indices so an empty slot is passed; ignoring the error return of a Try* call that produced the side-input collection; passing a PCollection from a different, failed sub-pipeline.","solutions":["Look at the index in the message, find the corresponding SideInput entry, and trace where its PCollection came from; fix the failed/ignored construction that yielded the zero value.","Handle the error from each Try* call producing side inputs instead of discarding it.","Validate each side input before use with `if !pc.IsValid() { return fmt.Errorf(\"side input %q is invalid\", name) }`.","Check loop indices and slices for off-by-one or nil-entry mistakes when assembling []beam.SideInput."],"exampleFix":"// before\nside, _ := beam.TryParDo(s, produce, root)\nbeam.ParDo0(s, consume, main, beam.SideInput{Input: side}) // invalid side pcollection: index 0\n\n// after\nside, err := beam.TryParDo(s, produce, root)\nif err != nil {\n    return err\n}\nbeam.ParDo0(s, consume, main, beam.SideInput{Input: side})","handlingStrategy":"validation","validationCode":"for i, in := range sideInputs {\n    if !in.Input.IsValid() {\n        return fmt.Errorf(\"side input %d is not initialized\", i)\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check errors from every Try* call that produces a side-input PCollection.","Validate the whole []beam.SideInput slice before handing it to a ParDo.","Name side inputs and assert validity right after construction to localize failures."],"tags":["apache-beam","go","side-input","pipeline-construction"],"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-14T16:17:12.679Z"}