{"record":{"id":"f5c86aa595a373fb","repo":"apache/beam","slug":"failed-getgroup-for-v-v","errorCode":null,"errorMessage":"failed getGroup for %v: %v","messagePattern":"failed getGroup for (.+?): (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/runners/direct/gbk.go","lineNumber":73,"sourceCode":"\tn.m = make(map[string]*group)\n\treturn nil\n}\n\nfunc (n *CoGBK) StartBundle(ctx context.Context, id string, data exec.DataContext) error {\n\treturn n.Out.StartBundle(ctx, id, data)\n}\n\nfunc (n *CoGBK) ProcessElement(ctx context.Context, elm *exec.FullValue, _ ...exec.ReStream) error {\n\tindex := elm.Elm2.(*exec.FullValue).Elm.(int)\n\tvalue := elm.Elm2.(*exec.FullValue).Elm2\n\n\tfor _, w := range elm.Windows {\n\t\tws := []typex.Window{w}\n\t\tn.wins = append(n.wins, ws...)\n\n\t\tg, err := n.getGroup(n.m, elm, ws)\n\t\tif err != nil {\n\t\t\treturn errors.Errorf(\"failed getGroup for %v: %v\", elm, err)\n\t\t}\n\t\tg.values[index] = append(g.values[index], exec.FullValue{Elm: value, Timestamp: elm.Timestamp})\n\t}\n\treturn nil\n}\n\nfunc (n *CoGBK) getGroup(m map[string]*group, elm *exec.FullValue, ws []typex.Window) (*group, error) {\n\tvar buf bytes.Buffer\n\tif err := n.enc.Encode(&exec.FullValue{Elm: elm.Elm}, &buf); err != nil {\n\t\treturn nil, errors.WithContextf(err, \"encoding key %v for CoGBK\", elm)\n\t}\n\tif err := n.wEnc.Encode(ws, &buf); err != nil {\n\t\treturn nil, errors.WithContextf(err, \"encoding window %v for CoGBK\", ws)\n\t}\n\tkey := buf.String()\n\tg, ok := m[key]\n\tif !ok {\n\t\tg = &group{","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/runners/direct/gbk.go#L55-L91","documentation":"In the direct runner's CoGBK ProcessElement, for each incoming window the node calls getGroup to create/look up the accumulation group for the key+window. If getGroup fails (e.g. inability to compute the window/key representation), the unit returns this error embedding the element and the cause, aborting the bundle.","triggerScenarios":"Processing an element in a CoGBK node where n.getGroup(n.m, elm, ws) errors — typically due to an unexpected window type or a failure encoding the key for grouping within the runner's in-memory map.","commonSituations":"Custom windowing strategies the direct runner's CoGBK doesn't handle; elements carrying malformed or zero windows after a WindowInto; pipelines mixing window merging semantics across inputs.","solutions":["Read the embedded cause (%v, err) — it names why getGroup failed for that element.","Verify the pipeline's windowing strategy is one the direct runner supports (fixed/interval/sessions), and that elements have valid windows.","Simplify custom WindowFn implementations or test them with window tests before running.","Reproduce with a minimal dataset to find the specific element whose windows trigger the failure."],"exampleFix":"// before\nbeam.WindowInto(s, window.NewCustomWindowing(weirdFn), col) // unsupported in CoGBK\n// after\nbeam.WindowInto(s, window.NewFixedWindows(10*time.Minute), col)","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"err := plan.Execute(ctx, \"\", exec.DataContext{})\nif err != nil && strings.Contains(err.Error(), \"failed getGroup\") {\n    log.Printf(\"CoGBK grouping failed on an element/window; inspect windows: %v\", err)\n}","preventionTips":["Use standard windowing strategies with CoGBK.","Validate custom WindowFns with unit tests.","Test CoGBK pipelines on tiny datasets first."],"tags":["go","beam","direct-runner","gbk","windowing"],"backgroundTag":"internal-invariant-violation","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T21:17:11.552Z"}