{"record":{"id":"5d0bee76d4032280","repo":"apache/beam","slug":"unexpected-windowing-strategy-v","errorCode":null,"errorMessage":"unexpected windowing strategy: %v","messagePattern":"unexpected windowing strategy: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/runtime/graphx/translate.go","lineNumber":1465,"sourceCode":"\t\t\tUrn: URNSlidingWindowsWindowFn,\n\t\t\tPayload: protox.MustEncode(\n\t\t\t\t&pipepb.SlidingWindowsPayload{\n\t\t\t\t\tSize:   durationpb.New(w.Size),\n\t\t\t\t\tPeriod: durationpb.New(w.Period),\n\t\t\t\t},\n\t\t\t),\n\t\t}, nil\n\tcase window.Sessions:\n\t\treturn &pipepb.FunctionSpec{\n\t\t\tUrn: URNSessionsWindowFn,\n\t\t\tPayload: protox.MustEncode(\n\t\t\t\t&pipepb.SessionWindowsPayload{\n\t\t\t\t\tGapSize: durationpb.New(w.Gap),\n\t\t\t\t},\n\t\t\t),\n\t\t}, nil\n\tdefault:\n\t\treturn nil, errors.Errorf(\"unexpected windowing strategy: %v\", w)\n\t}\n}\n\nfunc makeWindowCoder(w *window.Fn) (*coder.WindowCoder, error) {\n\tswitch w.Kind {\n\tcase window.GlobalWindows:\n\t\treturn coder.NewGlobalWindow(), nil\n\tcase window.FixedWindows, window.SlidingWindows, window.Sessions, URNSlidingWindowsWindowFn:\n\t\treturn coder.NewIntervalWindow(), nil\n\tdefault:\n\t\treturn nil, errors.Errorf(\"unexpected windowing strategy for coder: %v\", w)\n\t}\n}\n\nfunc mustEncodeMultiEdgeBase64(edge *graph.MultiEdge) (string, error) {\n\tref, err := EncodeMultiEdge(edge)\n\tif err != nil {\n\t\treturn \"\", errors.Wrapf(err, \"failed to serialize %v\", edge)","sourceCodeStart":1447,"sourceCodeEnd":1483,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/graphx/translate.go#L1447-L1483","documentation":"When marshalling a windowing strategy, MarshalWindowingStrategy switches on the window Fn's Kind and emits the corresponding runner-API payload (GlobalWindows, FixedWindows, SlidingWindows, SessionWindows). The default branch throws 'unexpected windowing strategy: %v' when the kind is none of these — i.e. a custom or unknown window function that has no runner-API representation.","triggerScenarios":"Applying a custom window.WindowFn (any Kind outside GlobalWindows/FixedWindows/SlidingWindows/SessionWindows) to a PCollection and then marshalling the pipeline (beam.Run or graphx.Marshal).","commonSituations":"Implementing a custom WindowFn in Go and submitting to a runner; copying pipelines from other SDKs with window kinds the Go marshaller doesn't cover; running older SDK code against pipelines built with newer window kinds.","solutions":["Replace the custom window function with one of the supported kinds (global, fixed, sliding, session)","If a custom window is essential, implement marshalling for it in MarshalWindowingStrategy (contribute upstream)","Check SDK versions on both producer and consumer of the pipeline for kind mismatches","File an issue on apache/beam if a standard window kind is unexpectedly unhandled"],"exampleFix":"// before — custom window fn\ncustom := window.NewCustomFn(...)\npc := beam.WindowInto(s, custom, input)\n// after — use a supported window kind\npc := beam.WindowInto(s, window.FixedWindows(30*time.Second), input)","handlingStrategy":"validation","validationCode":"// verify the window kind is one of the four supported kinds before WindowInto\nswitch fn.Kind {\ncase window.GlobalWindows, window.FixedWindows, window.SlidingWindows, window.SessionWindows:\n    // ok\ndefault:\n    return fmt.Errorf(\"window kind %v unsupported by Go marshaller\", fn.Kind)\n}","typeGuard":"func isMarshalableWindowKind(k window.Kind) bool {\n    return k == window.GlobalWindows || k == window.FixedWindows ||\n        k == window.SlidingWindows || k == window.SessionWindows\n}","tryCatchPattern":"defer func() {\n    if r := recover(); r != nil { /* marshalling panics */ }\n}()\nif err := beam.Run(ctx, pr); err != nil && strings.Contains(err.Error(), \"unexpected windowing strategy\") {\n    return fmt.Errorf(\"custom WindowFn not supported; use global/fixed/sliding/session: %w\", err)\n}","preventionTips":["Never submit pipelines with custom WindowFn implementations to remote runners","Map custom windowing needs onto the four supported kinds","Keep all SDK versions aligned to the same Beam release"],"tags":["go","apache-beam","windowing","invalid-enum"],"backgroundTag":"unsupported-windowing-strategy","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"}