apache/beam · error
unknown window type
Error message
unknown window type: %v
What it means
window (fn).Equals panics in its default case when a WindowFn's kind is not one of GlobalWindows, IntervalWindow, SlidingWindows, or Sessions. This indicates an unrecognized or unsupported window type is being compared, typically from a custom or unregistered WindowFn.
Solutions
- Use a supported window type (GlobalWindows, IntervalWindow, SlidingWindows, Sessions)
- If using a custom WindowFn, implement/extend Equals to handle it or upgrade Beam so the switch includes it
- Check for version skew between the Beam SDK versions building and comparing the strategies
Example fix
// before
fn := myCustomWindowFn{} // unknown to Equals
// after
fn := window.NewFixedWindows(60 * time.Second) // supported type Defensive patterns
Strategy: type-guard
Validate before calling
switch w.Kind {
case window.GlobalWindows, window.IntervalWindow, window.SlidingWindows, window.Sessions:
// safe to compare
default:
return fmt.Errorf("unsupported window type %T", w)
} Type guard
func isKnownWindowType(w window.WindowFn) bool {
switch w.(type) {
case window.GlobalWindows, window.IntervalWindow, window.SlidingWindows, window.Sessions:
return true
}
return false
} Try / catch
func safeEquals(w, o *window.WindowFn) (eq bool, err error) {
defer func() { if r := recover(); r != nil { err = fmt.Errorf("window equals: %v", r) } }()
return w.Equals(o), nil
} Prevention
- Stick to the four supported window kinds unless extending the SDK
- Align Beam SDK versions across modules to avoid unrecognized WindowFn kinds
- Handle custom WindowFns in your own comparison code
When it happens
Trigger: Calling (w *WindowFn).Equals(o) on a WindowFn whose type is none of the four known kinds — e.g. a newly added or custom windowing strategy not handled by the switch — during pipeline translation where windowing strategies are compared.
Common situations: Using a custom WindowFn type added in a newer Beam version while running a translation code path that predates it; mixing Beam versions between libraries that both construct WindowFn values.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- bad window kind
- bad window
- bad windowed value
- bad windowed value: %+v
- DoFns that observe windows must be invoked with single…
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/b734477975d1a494.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/go/pkg/beam/core/graph/window/fn.go:109
// Built-in window types (such as global window) are only equal to the same
// instances of the window. A user-defined window that happens to match a
// built-in will not match on Equals().
func (w *Fn) Equals(o *Fn) bool {
if w.Kind != o.Kind {
return false
}
switch w.Kind {
case GlobalWindows:
return true
case FixedWindows:
return w.Size == o.Size
case SlidingWindows:
return w.Period == o.Period && w.Size == o.Size
case Sessions:
return w.Gap == o.Gap
default:
panic(fmt.Sprintf("unknown window type: %v", w))
}
}
View on GitHub (pinned to 12126d8942)