{"record":{"id":"6319e56486bdf5e8","repo":"apache/beam","slug":"not-a-window-value-got-t","errorCode":null,"errorMessage":"not a Window Value, got %T","messagePattern":"not a Window Value, got %T","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/runtime/exec/window.go","lineNumber":133,"sourceCode":"}\n\n// Up does nothing\nfunc (m *MapWindows) Up(_ context.Context) error {\n\treturn nil\n}\n\nfunc (m *MapWindows) StartBundle(ctx context.Context, id string, data DataContext) error {\n\treturn m.Out.StartBundle(ctx, id, data)\n}\n\nfunc (m *MapWindows) ProcessElement(ctx context.Context, elm *FullValue, values ...ReStream) error {\n\t// MapWindows ends up with the wrappedDecode path, which can pass the value window through the\n\t// Window field. Use that as the default for resilience to a change to match the coder correctly.\n\twin := elm.Windows[0]\n\tif elm.Elm2 != nil {\n\t\tw, ok := elm.Elm2.(typex.Window)\n\t\tif !ok {\n\t\t\treturn errors.Errorf(\"not a Window Value, got %T\", elm.Elm2)\n\t\t}\n\t\twin = w\n\t}\n\tnewW, err := m.Fn.MapWindow(win)\n\tif err != nil {\n\t\treturn err\n\t}\n\tout := &FullValue{\n\t\tElm:       elm.Elm,\n\t\tElm2:      newW,\n\t\tTimestamp: elm.Timestamp,\n\t\tWindows:   elm.Windows,\n\t\tPane:      elm.Pane,\n\t}\n\treturn m.Out.ProcessElement(ctx, out, values...)\n}\n\n// FinishBundle propagates finish bundle to downstream nodes.","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/exec/window.go#L115-L151","documentation":"In exec/window.go, MapWindows' ProcessElement expects the second element of a KV-style windowed element (Elm2) to be a typex.Window. If Elm2 is non-nil but does not implement typex.Window, the SDK cannot determine the source window to remap and throws this error.","triggerScenarios":"A MapWindows transform receives an element whose second component is not a typex.Window — typically from a coder mismatch where the element decoded with the wrong coder, or a hand-built FullValue whose Elm2 is a non-window value.","commonSituations":"Custom coders that emit FullValues with two components where the second is data rather than a window; runner/coder incompatibilities after changing windowing or coder configuration; combining MapWindows with transforms producing non-KV/non-windowed pairs.","solutions":["Verify the PCollection feeding MapWindows uses the correct windowed-value coder so Elm2 decodes as typex.Window.","Check that upstream transforms emit elements in the expected (value, window) form and are not reordering components.","Regenerate/refresh coders after changing windowing strategy (e.g. switching from GlobalWindows to FixedWindows).","If constructing FullValues manually, set Elm2 to the actual typex.Window value or leave it nil to use Windows[0]."],"exampleFix":"// before (manual FullValue construction)\nbeam.FullValue{Elm: val, Elm2: timestamp} // Elm2 is a time, not a Window\n// after\nbeam.FullValue{Elm: val, Windows: []typex.Window{w}} // put window in Windows, leave Elm2 nil\n","handlingStrategy":"type-guard","validationCode":"if fv.Elm2 != nil {\n    if _, ok := fv.Elm2.(typex.Window); !ok {\n        return fmt.Errorf(\"element second component is %T, not a typex.Window\", fv.Elm2)\n    }\n}","typeGuard":"func isWindow(v any) bool {\n    _, ok := v.(typex.Window)\n    return ok\n}","tryCatchPattern":"win, err := mapWindowsResult(...)\nif err != nil && strings.Contains(err.Error(), \"not a Window Value\") {\n    log.Printf(\"coder/window mismatch: %v\", err)\n}","preventionTips":["Keep default coders for windowed PCollections; avoid hand-rolled coders for windowing.","Never populate FullValue.Elm2 with anything other than typex.Window.","Re-verify coders after changing windowing strategies mid-pipeline.","Test window transforms with a DirectRunner before deploying to remote runners."],"tags":["go","windows","coder","type-mismatch"],"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"}