{"record":{"id":"b08daf9d1ff5f8cc","repo":"apache/beam","slug":"bad-windowed-value-v-dataflow","errorCode":null,"errorMessage":"bad windowed value: %+v","messagePattern":"bad windowed value: %\\+v","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/runtime/graphx/dataflow.go","lineNumber":316,"sourceCode":"\tcase lengthPrefixType:\n\t\tif len(c.Components) != 1 {\n\t\t\treturn nil, errors.Errorf(\"bad length prefix: %+v\", c)\n\t\t}\n\n\t\tsubC := c.Components[0]\n\t\tswitch subC.Type {\n\t\tcase stringType: // Needs special handling if wrapped by dataflow.\n\t\t\treturn coder.NewString(), nil\n\t\tdefault:\n\t\t\treturn decodeDataflowCustomCoder(subC.Type)\n\t\t}\n\n\tcase intervalWindowType:\n\t\treturn coder.NewIntervalWindowCoder(), nil\n\n\tcase windowedValueType:\n\t\tif len(c.Components) != 2 {\n\t\t\treturn nil, errors.Errorf(\"bad windowed value: %+v\", c)\n\t\t}\n\n\t\telm, err := DecodeCoderRef(c.Components[0])\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tw, err := decodeWindowCoder(c.Components[1])\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tt := typex.New(typex.WindowedValueType, elm.T)\n\n\t\treturn &coder.Coder{Kind: coder.WindowedValue, T: t, Components: []*coder.Coder{elm}, Window: w}, nil\n\n\tcase streamType:\n\t\tif len(c.Components) != 1 {\n\t\t\treturn nil, errors.Errorf(\"bad iterable/stream: %+v\", c)\n\t\t}","sourceCodeStart":298,"sourceCodeEnd":334,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/graphx/dataflow.go#L298-L334","documentation":"DecodeCoderRef converts windowed-value refs back into coders. The runner-side encoded form of a windowed value has exactly two components (the element coder and the window coder); any other count is malformed, so decoding fails with the ref printed.","triggerScenarios":"Decoding a CoderRef with Type windowedValueType whose Components has length != 2 — during pipeline deserialization where a windowed coder was encoded with a different shape (e.g. a version that omits or adds the window component).","commonSituations":"Cross-version pipelines (older SDKs encoded windowed values with one component); custom graph-rewriting tools that dropped the window component; hand-edited pipeline artifacts.","solutions":["Regenerate the pipeline artifact with the same SDK version used to decode it.","Ensure graph-rewriting tools preserve both element and window components of windowed coders.","Inspect the printed CoderRef: if it has one component, the producer SDK encodes windowed values differently — align versions.","If hand-building CoderRefs for tests, include the window coder as the second component."],"exampleFix":"// before\nref := &graphx.CoderRef{Type: graphx.WindowedValue, Components: []*graphx.CoderRef{elmRef}}\nc, err := graphx.DecodeCoderRef(ref)\n\n// after\nref := &graphx.CoderRef{Type: graphx.WindowedValue, Components: []*graphx.CoderRef{elmRef, windowRef}}\nc, err := graphx.DecodeCoderRef(ref)","handlingStrategy":"try-catch","validationCode":"func validWindowedRef(r *graphx.CoderRef) bool {\n\treturn r != nil && r.Type == graphx.WindowedValue && len(r.Components) == 2\n}","typeGuard":"func isWindowedRef(r *graphx.CoderRef) bool { return r != nil && r.Type == graphx.WindowedValue && len(r.Components) == 2 }","tryCatchPattern":"c, err := graphx.DecodeCoderRef(ref)\nif err != nil {\n\tif strings.Contains(err.Error(), \"bad windowed value\") {\n\t\treturn nil, fmt.Errorf(\"windowed ref needs element + window components %v: %w\", ref, err)\n\t}\n\treturn nil, err\n}","preventionTips":["Match SDK versions between pipeline producers and consumers","Preserve both components when rewriting windowed coders in custom passes","Include windowed pipelines in round-trip encode/decode tests"],"tags":["go","beam","windowing","coder-deserialization"],"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"}