{"record":{"id":"a35680e193fefc91","repo":"apache/beam","slug":"invalid-input-pcollection","errorCode":null,"errorMessage":"invalid input pcollection","messagePattern":"invalid input pcollection","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/windowing.go","lineNumber":85,"sourceCode":"func (m allowedLateness) windowIntoOption() {}\n\n// AllowedLateness configures for how long data may arrive after the end of a window.\nfunc AllowedLateness(delay time.Duration) WindowIntoOption {\n\treturn allowedLateness{delay: delay}\n}\n\n// WindowInto applies the windowing strategy to each element.\nfunc WindowInto(s Scope, ws *window.Fn, col PCollection, opts ...WindowIntoOption) PCollection {\n\treturn Must(TryWindowInto(s, ws, col, opts...))\n}\n\n// TryWindowInto attempts to insert a WindowInto transform.\nfunc TryWindowInto(s Scope, wfn *window.Fn, col PCollection, opts ...WindowIntoOption) (PCollection, error) {\n\tif !s.IsValid() {\n\t\treturn PCollection{}, errors.New(\"invalid scope\")\n\t}\n\tif !col.IsValid() {\n\t\treturn PCollection{}, errors.New(\"invalid input pcollection\")\n\t}\n\tws := window.WindowingStrategy{Fn: wfn, Trigger: trigger.DefaultTrigger{}}\n\tfor _, opt := range opts {\n\t\tswitch opt := opt.(type) {\n\t\tcase windowTrigger:\n\t\t\t// TODO(BEAM-3304): call validation on trigger construction here\n\t\t\t// so local errors can be returned to the user in their pipeline\n\t\t\t// context instead of at pipeline translation time.\n\t\t\tws.Trigger = opt.trigger\n\t\tcase accumulationMode:\n\t\t\tws.AccumulationMode = opt.mode\n\t\tcase allowedLateness:\n\t\t\tws.AllowedLateness = int(opt.delay / time.Millisecond)\n\t\tdefault:\n\t\t\tpanic(fmt.Sprintf(\"Unknown WindowInto option type: %T: %v\", opt, opt))\n\t\t}\n\t}\n","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/windowing.go#L67-L103","documentation":"beam.TryWindowInto checks that the main input PCollection is valid before inserting the WindowInto transform. This error means col is the zero PCollection — usually the result of a previously failed (and ignored) Try-transform call or an unassigned variable — so there is no graph node to window.","triggerScenarios":"beam.TryWindowInto(s, wfn, col) with col == beam.PCollection{}; typical chain: `col, _ := beam.TryParDo(...)`, then WindowInto on the zero result.","commonSituations":"Swallowed errors from earlier Try* transforms feeding the windowing step; conditional logic that leaves a PCollection unassigned; passing a PCollection built in a pipeline other than the current scope's pipeline.","solutions":["Propagate errors from every upstream Try* call so a zero PCollection never reaches WindowInto.","Verify the variable passed as col is the actual output of a successful transform.","Use Must-style constructors (impulse/ParDo) while debugging so the first failure panics at the source.","Add `if !col.IsValid() { return PCollection{}, errors.New(\"input not initialized\") }` guards in helper functions wrapping windowing."],"exampleFix":"// before\nout, _ := beam.TryParDo(s, fn, input)\nout, _ = beam.TryWindowInto(s, window.SlidingWindows(d, p), out)\n\n// after\nout, err := beam.TryParDo(s, fn, input)\nif err != nil {\n    return err\n}\nout, err = beam.TryWindowInto(s, window.SlidingWindows(d, p), out)\nif err != nil {\n    return err\n}","handlingStrategy":"validation","validationCode":"if !col.IsValid() {\n    return PCollection{}, errors.New(\"WindowInto input is a zero PCollection; check upstream Try* errors\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check every upstream Try* error so a zero PCollection never flows into windowing.","Use Must constructors while debugging to make the first failure panic at its source.","Keep pipelines linear in code review: every PCollection assignment should follow an error check."],"tags":["apache-beam","go","windowing","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"}