apache/beam · error

unexpected windowing strategy for coder: %v

Error message

unexpected windowing strategy for coder: %v

What it means

During pipeline translation to the Beam runner proto format, each PCollection's windowing strategy must map to a known window coder. This error is thrown when a windowfn kind is not one of GlobalWindows, FixedWindows, SlidingWindows, Sessions, or the known sliding-windows URN, so graphx cannot pick a window coder for serialization.

Source

Thrown at sdks/go/pkg/beam/core/runtime/graphx/translate.go:1476

			Payload: protox.MustEncode(
				&pipepb.SessionWindowsPayload{
					GapSize: durationpb.New(w.Gap),
				},
			),
		}, nil
	default:
		return nil, errors.Errorf("unexpected windowing strategy: %v", w)
	}
}

func makeWindowCoder(w *window.Fn) (*coder.WindowCoder, error) {
	switch w.Kind {
	case window.GlobalWindows:
		return coder.NewGlobalWindow(), nil
	case window.FixedWindows, window.SlidingWindows, window.Sessions, URNSlidingWindowsWindowFn:
		return coder.NewIntervalWindow(), nil
	default:
		return nil, errors.Errorf("unexpected windowing strategy for coder: %v", w)
	}
}

func mustEncodeMultiEdgeBase64(edge *graph.MultiEdge) (string, error) {
	ref, err := EncodeMultiEdge(edge)
	if err != nil {
		return "", errors.Wrapf(err, "failed to serialize %v", edge)
	}
	return protox.MustEncodeBase64(&v1pb.TransformPayload{
		Urn:  URNDoFn,
		Edge: ref,
	}), nil
}

func edgeID(edge *graph.MultiEdge) string {
	return fmt.Sprintf("e%v", edge.ID())
}

View on GitHub (pinned to 12126d8942)

Solutions

  1. Use one of the supported windowings: window.NewGlobalWindows, NewFixedWindows, NewSlidingWindows, or NewSessions.
  2. If a custom windowFn is required, check that its Kind() and URN match a case in translate.go's window coder switch, or register an equivalent URN.
  3. Upgrade or downgrade the Beam Go SDK so the window kind is supported by graphx translation.

Example fix

// before
w := beam.WindowInto(s, myCustomWindowFn{}, in)
// after
w := beam.WindowInto(s, window.NewFixedWindows(60*time.Second), in)
Defensive patterns

Strategy: validation

Validate before calling

switch wfn.Kind() {
case window.KindGlobalWindow, window.KindFixedWindows, window.KindSlidingWindows, window.KindSessions:
    // supported
default:
    return fmt.Errorf("windowing strategy %T unsupported by Go SDK translation", wfn)
}

Prevention

When it happens

Trigger: Calling window.As/beam.WindowInto with a custom or unrecognized windowfn whose kind does not match any case in translateWindowCoder, so EncodeWindowCoder fails while marshaling the pipeline.

Common situations: Implementing a custom windowFn without registering it in graphx; using a third-party window strategy unsupported by the Go SDK; SDK/runner version mismatch where a new window kind is not yet handled by the translator.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/0bb14dfcd39c184b. Report an issue: GitHub.