{"record":{"id":"e01d50a1373734f7","repo":"apache/beam","slug":"unexpected-window-fn-v","errorCode":null,"errorMessage":"Unexpected window fn: %v","messagePattern":"Unexpected window fn: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/runtime/exec/window.go","lineNumber":86,"sourceCode":"\t\treturn []typex.Window{window.IntervalWindow{Start: start, End: end}}\n\n\tcase window.SlidingWindows:\n\t\tvar ret []typex.Window\n\n\t\tperiod := mtime.FromDuration(wfn.Period)\n\t\tlastStart := ts - (ts % period)\n\t\tfor start := lastStart; start > ts.Subtract(wfn.Size); start -= period {\n\t\t\tret = append(ret, window.IntervalWindow{Start: start, End: start.Add(wfn.Size)})\n\t\t}\n\t\treturn ret\n\tcase window.Sessions:\n\t\t// Assign each element into a window from its timestamp until Gap in the\n\t\t// future.  Overlapping windows (representing elements within Gap of\n\t\t// each other) will be merged.\n\t\treturn []typex.Window{window.IntervalWindow{Start: ts, End: ts.Add(wfn.Gap)}}\n\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Unexpected window fn: %v\", wfn))\n\t}\n}\n\nfunc (w *WindowInto) FinishBundle(ctx context.Context) error {\n\treturn w.Out.FinishBundle(ctx)\n}\n\nfunc (w *WindowInto) Down(ctx context.Context) error {\n\treturn nil\n}\n\nfunc (w *WindowInto) String() string {\n\treturn fmt.Sprintf(\"WindowInto[%v]. Out:%v\", w.Fn, w.Out.ID())\n}\n\n// MapWindows maps each element window from a main input window space\n// to window from a side input window space.\ntype MapWindows struct {","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/exec/window.go#L68-L104","documentation":"exec.assignWindows maps a window.WindowFn to its Go implementation (global, fixed, sliding, sessions, custom). Any windowfn type outside the handled cases has no assignment logic, so the library panics rather than silently mis-windowing elements.","triggerScenarios":"Using a window.WindowFn value in a WindowInto transform (via assignWindows, called from ProcessElement or MapWindow) that is not one of: GlobalWindows, FixedWindows, SlidingWindows, Sessions, or a recognized custom fn.","commonSituations":"Passing a wrongly-typed value as a WindowFn (e.g. a trigger or a custom struct that isn't registered); deserializing a pipeline whose window fn URN is unknown to this SDK version.","solutions":["Use window.NewGlobalWindows(), window.NewFixedWindows(...), window.NewSlidingWindows(...), or window.NewSessions(...) constructors","If implementing a custom WindowFn, ensure it is registered and implements the expected window.WindowFn interface","Check the pipeline payload/URN for window fn types not supported by the installed Beam Go SDK version"],"exampleFix":"// before\nw := beam.WindowInto(scope, myUnknownWindower{}, col)\n// after\nw := beam.WindowInto(scope, window.NewFixedWindows(60*time.Second), col)","handlingStrategy":"validation","validationCode":"switch wfn.(type) {\ncase window.GlobalWindows, window.FixedWindows, window.SlidingWindows, window.Sessions:\ndefault:\n    return fmt.Errorf(\"unsupported window fn: %T\", wfn)\n}","typeGuard":null,"tryCatchPattern":"defer func() { if r := recover(); r != nil { err = fmt.Errorf(\"window assignment: %v\", r) } }()","preventionTips":["Only use the window.New* constructors","Check SDK release notes for newly supported window fns","Validate window fn types before graph execution"],"tags":["go","apache-beam","windowing","panic"],"backgroundTag":"invalid-enum-value","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}