apache/beam · error
mismatched CoGBK windowing strategies: %v, want %v
Error message
mismatched CoGBK windowing strategies: %v, want %v
What it means
Error returned by NewCoGBK when an input's windowing strategy differs from the first input's (w). All inputs to a CoGBK must share the same windowing strategy so per-window grouping is well defined; the message shows the mismatched strategy versus the expected one.
Source
Thrown at sdks/go/pkg/beam/core/graph/edge.go:228
}
// (1) Create CoGBK result type: KV<T,U>, .., KV<T,Z> -> CoGBK<T,U,..,Z>.
c := ns[0].Coder.Components[0]
w := inputWindow(ns)
bounded := inputBounded(ns)
comp := []typex.FullType{c.T, ns[0].Type().Components()[1]}
for i := 1; i < len(ns); i++ {
n := ns[i]
if !typex.IsKV(n.Type()) {
return nil, addContext(errors.Errorf("input type must be KV: %v", n), s)
}
if !n.Coder.Components[0].Equals(c) {
return nil, addContext(errors.Errorf("key coder for %v is %v, want %v", n, n.Coder.Components[0], c), s)
}
if !w.Equals(n.WindowingStrategy()) {
return nil, addContext(errors.Errorf("mismatched CoGBK windowing strategies: %v, want %v", n.WindowingStrategy(), w), s)
}
if bounded != n.Bounded() {
return nil, addContext(errors.Errorf("unmatched CoGBK boundedness: %v, want %v", n.Bounded(), bounded), s)
}
comp = append(comp, n.Type().Components()[1])
}
t := typex.NewCoGBK(comp...)
out := g.NewNode(t, w, bounded)
// (2) Add CoGBK edge
edge := g.NewEdge(s)
edge.Op = CoGBK
for i := 0; i < len(ns); i++ {
edge.Input = append(edge.Input, &Inbound{Kind: Main, From: ns[i], Type: ns[i].Type()})
}View on GitHub (pinned to 12126d8942)
Solutions
- Apply the same windowing (beam.WindowInto with identical strategy) to all inputs before CoGroupByKey
- Align boundedness: re-window streaming inputs or re-read batch inputs consistently
- Inspect each PCollection's WindowingStrategy in tests to confirm equality
Example fix
// before wA := beam.WindowInto(s, window.NewFixedWindows(60), a) beam.CoGroupByKey(s, wA, b) // b global windows // after wB := beam.WindowInto(s, window.NewFixedWindows(60), b) beam.CoGroupByKey(s, wA, wB)
Defensive patterns
Strategy: validation
Validate before calling
strategy := inputs[0].WindowingStrategy()
for i, c := range inputs[1:] {
if !strategy.Equals(c.WindowingStrategy()) {
return fmt.Errorf("input %d windowing mismatch", i+1)
}
} Try / catch
if err := beam.TryCoGroupByKey(s, a, b); err != nil {
return fmt.Errorf("CoGroupByKey windowing strategies differ: %w", err)
} Prevention
- Apply identical beam.WindowInto strategies to all CoGBK inputs
- Avoid mixing bounded and unbounded inputs in one CoGroupByKey
- Assert windowing strategy equality in pipeline construction tests
When it happens
Trigger: CoGroupByKey combining a bounded/unbounded input, or inputs with different triggers, allowed lateness, or window assignments (e.g. fixed vs global windows).
Common situations: Mixing batch and streaming sources in one CoGroupByKey, or applying custom windowing to only some inputs.
Understand the failure class
Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.
Related errors
- error encoding pane %v: non-speculative index value must be
- failed to map main input window to side input window with Wi
- input type must be KV: %v
- key coder for %v is %v, want %v
- failed to decode union value '%v' for key %v
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/78928c9ec5ba3eeb.
Report an issue: GitHub.