{"record":{"id":"588d12a68f7e6b62","repo":"apache/beam","slug":"unexpected-expand-coder-v","errorCode":null,"errorMessage":"unexpected expand coder: %v","messagePattern":"unexpected expand coder: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/runtime/exec/translate.go","lineNumber":733,"sourceCode":"\t\t\t// JIRA BEAM-12438 - an extra LP coder can get added here, but isn't added\n\t\t\t// on decode. Strip them until we get a better fix.\n\t\t\tif valCoder.Kind == coder.LP {\n\t\t\t\t// strip unexpected length prefix coder.\n\t\t\t\tvalCoder = valCoder.Components[0]\n\t\t\t}\n\t\t\tu = &Inject{UID: b.idgen.New(), N: (int)(tp.GetInject().GetN()), ValueEncoder: MakeElementEncoder(valCoder), Out: out[0]}\n\n\t\tcase graphx.URNExpand:\n\t\t\tvar pid string\n\t\t\tfor _, id := range transform.GetOutputs() {\n\t\t\t\tpid = id\n\t\t\t}\n\t\t\tc, _, err := b.makeCoderForPCollection(pid)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tif !coder.IsCoGBK(c) {\n\t\t\t\treturn nil, errors.Errorf(\"unexpected expand coder: %v\", c)\n\t\t\t}\n\n\t\t\tvar decoders []ElementDecoder\n\t\t\tfor _, dc := range c.Components[1:] {\n\t\t\t\tdecoders = append(decoders, MakeElementDecoder(dc))\n\t\t\t}\n\t\t\t// Strip PCollections from Expand nodes, as CoGBK metrics are handled by\n\t\t\t// the DataSource that preceeds them.\n\t\t\ttrueOut := out[0]\n\t\t\tif pcol, ok := trueOut.(*PCollection); ok {\n\t\t\t\ttrueOut = pcol.Out\n\t\t\t}\n\t\t\tb.units = b.units[:len(b.units)-1]\n\t\t\tu = &Expand{UID: b.idgen.New(), ValueDecoders: decoders, Out: trueOut}\n\n\t\tcase graphx.URNReshuffleInput:\n\t\t\t_, w, err := b.makeCoderForPCollection(from)\n\t\t\tif err != nil {","sourceCodeStart":715,"sourceCodeEnd":751,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/exec/translate.go#L715-L751","documentation":"The URNExpand transform (expanding a CoGBK result back into per-input streams) requires the output PCollection's coder to be CoGBK so per-input decoders can be built from its components. A non-CoGBK coder fails translation with this error.","triggerScenarios":"Coder for the Expand transform's output PCollection is not CoGBK — e.g. runner/SDK coder inference disagreement, custom coders collapsing the CoGBK structure, or a hand-built pipeline proto with a mismatched coder ID.","commonSituations":"CoGBK/Flatten pipelines crossing SDK version upgrades; custom coders registered on runner but altering component counts; foreign runners mislabeling the expand output coder.","solutions":["Align SDK harness and pipeline builder versions and resubmit","Verify the output coder ID in the pipeline proto resolves to a CoGBK coder; correct coder payloads if custom","Ensure custom coder implementations preserve the CoGBK component structure (one component per input, index 0 = window/header)."],"exampleFix":"null","handlingStrategy":"validation","validationCode":"c, _, err := b.makeCoderForPCollection(pid)\nif err != nil {\n\treturn err\n}\nif !coder.IsCoGBK(c) {\n\treturn fmt.Errorf(\"expand output must be CoGBK-coded, got %v\", c)\n}","typeGuard":"null","tryCatchPattern":"null","preventionTips":["Test CoGBK/Flatten pipelines with the production container image","Keep custom coders from collapsing CoGBK components","Keep SDK and runner versions aligned"],"tags":["go","apache-beam","coder","cogbk"],"backgroundTag":"type-mismatch","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"}