{"record":{"id":"343ec37ceb9fc858","repo":"apache/beam","slug":"failed-to-expand-cogbk-transform-for-edge-v","errorCode":null,"errorMessage":"failed to expand CoGBK transform for edge: %v","messagePattern":"failed to expand CoGBK transform for edge: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/runtime/graphx/translate.go","lineNumber":807,"sourceCode":"\t\t\toutputs[fmt.Sprintf(\"i%v\", i)] = nodeID(out.To)\n\t\t}\n\t\ttransform.Outputs = outputs\n\t\tenvironment, err := ExpandedTransform(edge.External.Expanded)\n\t\tif err != nil {\n\t\t\treturn \"\", errors.Wrapf(err, \"failed to expand cross language transform for edge: %v\", namedEdge)\n\t\t}\n\t\ttransform.EnvironmentId = environment.EnvironmentId\n\t}\n\n\tm.transforms[id] = transform\n\treturn id, nil\n}\n\nfunc (m *marshaller) expandCoGBK(edge NamedEdge) (string, error) {\n\t// TODO(https://github.com/apache/beam/issues/18032): replace once CoGBK is a primitive. For now, we have to translate\n\t// CoGBK with multiple PCollections as described in cogbk.go.\n\thandleErr := func(err error) (string, error) {\n\t\treturn \"\", errors.Wrapf(err, \"failed to expand CoGBK transform for edge: %v\", edge)\n\t}\n\n\tid := edgeID(edge.Edge)\n\tkvCoder, err := MakeKVUnionCoder(edge.Edge)\n\tif err != nil {\n\t\treturn handleErr(err)\n\t}\n\tkvCoderID, err := m.coders.Add(kvCoder)\n\tif err != nil {\n\t\treturn handleErr(err)\n\t}\n\tgbkCoder, err := MakeGBKUnionCoder(edge.Edge)\n\tif err != nil {\n\t\treturn handleErr(err)\n\t}\n\tgbkCoderID, err := m.coders.Add(gbkCoder)\n\tif err != nil {\n\t\treturn handleErr(err)","sourceCodeStart":789,"sourceCodeEnd":825,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/graphx/translate.go#L789-L825","documentation":"expandCoGBK implements CoGBK as a composite of GBK + Flatten + a KV-union coder (since CoGBK is not yet a primitive). Any failure while making the union coder, the per-input nodes, or the intermediate GBK transforms is wrapped as 'failed to expand CoGBK transform for edge: %v'. handleErr wraps errors from MakeKVUnionCoder and the sub-translations.","triggerScenarios":"A CoGBK (beam.CoGroupByKey or multi-input CoGBK) edge where MakeKVUnionCoder fails (e.g. input coders cannot form a union coder) or any intermediate node/GBK expansion fails.","commonSituations":"CoGroupByKey over PCollections with incompatible or custom coders; unbounded/unsupported windowing on CoGBK inputs; SDK versions where the CoGBK expansion is still limited (see issue #18032).","solutions":["Inspect the wrapped inner error (usually coder or windowing marshal failure)","Ensure all CoGBK inputs use compatible, serializable coders","Use beam.CoGroupByKey with standard KV types; avoid custom coders on the inputs","Upgrade the Go SDK; CoGBK translation has received fixes since the TODO referenced"],"exampleFix":"null","handlingStrategy":"validation","validationCode":"// check CoGBK inputs use marshalable coders\nfor _, col := range cogbkInputs {\n    if reflect.TypeOf(beam.EncodedCoder{}) == nil {\n        _ = col // ensure standard KV types\n    }\n    // simplest check: build the union coder beforehand\n    if _, err := graphx.MakeKVUnionCoder(nil); err != nil {\n        return err\n    }\n}","typeGuard":null,"tryCatchPattern":"err := beam.Run(ctx, pr)\nif err != nil && strings.Contains(err.Error(), \"failed to expand CoGBK transform\") {\n    log.Printf(\"CoGBK expansion failed — check input coders/windowing: %v\", err)\n    return err\n}","preventionTips":["Use beam.CoGroupByKey on plain KV PCollections with standard coders","Avoid mixing bounded/unbounded inputs with exotic windowing in CoGBK","Keep SDK current (CoGBK expansion had known limitations, issue #18032)"],"tags":["go","apache-beam","cogbk","coder"],"backgroundTag":"coder-registration-failed","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}