{"record":{"id":"ee4a513877c53e79","repo":"apache/beam","slug":"could-not-unmarshal-windowed-value-coder-from-v-expected-two","errorCode":null,"errorMessage":"could not unmarshal windowed value coder from %v, expected two components but got %d","messagePattern":"could not unmarshal windowed value coder from (.+?), expected two components but got (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/runtime/graphx/coder.go","lineNumber":303,"sourceCode":"\t\t\t}\n\t\t\tcustom.ID = components[0]\n\t\t\tt := typex.New(custom.Type)\n\t\t\tcc := &coder.Coder{Kind: coder.Custom, T: t, Custom: custom}\n\t\t\treturn cc, nil\n\t\t// case urnBytesCoder, urnStringCoder: // implicitly length prefixed types.\n\t\t//\treturn b.makeCoder(components[0], sub)\n\t\tdefault:\n\t\t\t// Handle Length prefixing dictated by the runner.\n\t\t\tcc, err := b.makeCoder(components[0], sub)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn &coder.Coder{Kind: coder.LP, T: cc.T, Components: []*coder.Coder{cc}}, nil\n\t\t}\n\n\tcase urnWindowedValueCoder, urnParamWindowedValueCoder:\n\t\tif len(components) != 2 {\n\t\t\treturn nil, errors.Errorf(\"could not unmarshal windowed value coder from %v, expected two components but got %d\", c, len(components))\n\t\t}\n\n\t\telm, err := b.Coder(components[0])\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tw, err := b.WindowCoder(components[1])\n\t\tif err != nil {\n\t\t\treturn nil, errors.Errorf(\"could not unmarshal window coder: %w\", err)\n\t\t}\n\t\tt := typex.New(typex.WindowedValueType, elm.T)\n\t\twvc := &coder.Coder{Kind: coder.WindowedValue, T: t, Components: []*coder.Coder{elm}, Window: w}\n\t\tif urn == urnWindowedValueCoder {\n\t\t\treturn wvc, nil\n\t\t}\n\t\twvc.Kind = coder.ParamWindowedValue\n\t\twvc.Window.Payload = string(c.GetSpec().GetPayload())\n\t\treturn wvc, nil","sourceCodeStart":285,"sourceCodeEnd":321,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/graphx/coder.go#L285-L321","documentation":"makeCoder handles both the standard and parametrized windowed-value coder URNs and expects exactly two components: the element coder and the window coder. Any other component count triggers this error naming the coder proto and the observed count.","triggerScenarios":"makeCoder on beam:coders:windowed_value:v1 (or param_windowed_value) with components != 2, from malformed protos or non-conformant runners/SDKs.","commonSituations":"Hand-built pipeline protos missing the window component; interop with foreign SDK versions emitting different arity; corrupted pipeline serialization.","solutions":["Ensure the windowed value coder declares exactly two components: [element coder, window coder].","Regenerate the pipeline proto with a standard Beam SDK instead of manual construction.","Check for version skew between the SDK that produced the pipeline and the local unmarshaller.","Inspect the coder proto in the message to identify which component is missing or extra."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if wv := comps.GetCoders()[wvCoderID]; wv != nil && len(wv.GetComponentCoderIds()) != 2 {\n    return fmt.Errorf(\"windowed value coder %s must have [element, window] components, has %d\", wvCoderID, len(wv.GetComponentCoderIds()))\n}","typeGuard":null,"tryCatchPattern":"cd, err := um.Coder(id)\nif err != nil && strings.Contains(err.Error(), \"expected two components\") {\n    log.Printf(\"malformed windowed value coder: %v\", err)\n}","preventionTips":["Always pair an element coder with a window coder in windowed value coders.","Use standard Beam SDK marshaling instead of manual proto construction.","Align SDK versions between pipeline producer and unmarshaling side."],"tags":["go","coder","windowed-value","arity"],"backgroundTag":"unexpected-response-shape","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"}