{"record":{"id":"d063daf270513410","repo":"apache/beam","slug":"expected-wv-coder-for-side-input-v-v","errorCode":null,"errorMessage":"expected WV coder for side input %v: %v","messagePattern":"expected WV coder for side input (.+?): (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/runtime/exec/sideinput.go","lineNumber":53,"sourceCode":"\tNewIterable(ctx context.Context, reader StateReader, w typex.Window) (ReStream, error)\n\tNewKeyedIterable(ctx context.Context, reader StateReader, w typex.Window, iterKey any) (ReStream, error)\n}\n\ntype sideInputAdapter struct {\n\tsid         StreamID\n\tsideInputID string\n\twc          WindowEncoder\n\tkc          ElementEncoder\n\tec          ElementDecoder\n\twm          WindowMapper\n\tc           *coder.Coder\n}\n\n// NewSideInputAdapter returns a side input adapter for the given StreamID and coder.\n// It expects a W<V> or W<KV<K,V>> coder, because the protocol requires windowing information.\nfunc NewSideInputAdapter(sid StreamID, sideInputID string, c *coder.Coder, wm WindowMapper) SideInputAdapter {\n\tif !coder.IsW(c) {\n\t\tpanic(fmt.Sprintf(\"expected WV coder for side input %v: %v\", sid, c))\n\t}\n\n\twc := MakeWindowEncoder(c.Window)\n\tvar kc ElementEncoder\n\tvar ec ElementDecoder\n\tif coder.IsKV(coder.SkipW(c)) {\n\t\tkc = MakeElementEncoder(coder.SkipW(c).Components[0])\n\t\tec = MakeElementDecoder(coder.SkipW(c).Components[1])\n\t} else {\n\t\tec = MakeElementDecoder(coder.SkipW(c))\n\t}\n\treturn &sideInputAdapter{sid: sid, sideInputID: sideInputID, wc: wc, kc: kc, ec: ec, wm: wm, c: c}\n}\n\n// NewIterable returns a ReStream of an iterable side input from the runner, either by getting the ReStream from\n// the side input cache or by opening a new stream and reading it in.\nfunc (s *sideInputAdapter) NewIterable(ctx context.Context, reader StateReader, w typex.Window) (ReStream, error) {\n\tkey := []byte(iterableSideInputKey)","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/exec/sideinput.go#L35-L71","documentation":"NewSideInputAdapter builds the encoding/decoding machinery for a side input and requires the coder to be a windowed coder (W<V> or W<KV<K,V>>), because the side-input wire protocol carries windowing information. If coder.IsW(c) is false the function panics with this message naming the StreamID and coder. This is a construction-time contract check protecting the protocol.","triggerScenarios":"Calling NewSideInputAdapter with a non-windowed coder; a PCollection whose coder lost its window wrapper (e.g. built with coder.New without NewW); translation bugs where the window was skipped before adapter creation.","commonSituations":"Custom exec/translation code or tests constructing side input adapters manually with raw coders; pipeline graph manipulation that strips windowing; writing unit tests (like TestNewIterable_BadMapper) that pass bad coders intentionally.","solutions":["Wrap the coder in a windowed coder: coder.NewW(inner, window.Window{}) before creating the adapter","Ensure the side input PCollection was created through normal beam.ParDo/beam.SideInput plumbing, not hand-built coders","Check custom translation code for coder.SkipW calls leaking into adapter construction","If hit in SDK-internal translation of a normal pipeline, file a bug with the graph JSON"],"exampleFix":"// before\nadapter := exec.NewSideInputAdapter(sid, sideID, kvCoder, wm) // kvCoder is not windowed\n// after\nadapter := exec.NewSideInputAdapter(sid, sideID, coder.NewW(kvCoder, window.GlobalWindows{}.Coder()), wm)","handlingStrategy":"validation","validationCode":"if !coder.IsW(c) {\n    c = coder.NewW(c, window.GlobalWindows{}) // wrap before adapter creation\n}","typeGuard":"func isWindowed(c *coder.Coder) bool { return coder.IsW(c) }","tryCatchPattern":"// Go: recover in custom translation/test harnesses\ndefer func() {\n    if r := recover(); r != nil {\n        if strings.Contains(fmt.Sprint(r), \"expected WV coder\") {\n            log.Fatalf(\"side input coder not windowed: %v\", r)\n        }\n        panic(r)\n    }\n}()","preventionTips":["Never construct side input adapters from coder.SkipW results","Build side inputs through beam.SideInput plumbing, not hand-built coders","Check coder.IsW before any custom side-input handling","Keep translation code updated with the SDK's windowing conventions"],"tags":["go","apache-beam","side-input","coder"],"backgroundTag":"incompatible-source-type","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"}