apache/beam · error · ValueError
window fn (%s) does not have a determanistic coder (%s)
Error message
window fn (%s) does not have a determanistic coder (%s)
What it means
Raised in the Windowing constructor when the provided window function's window coder reports is_deterministic() == False. Beam serializes window objects (e.g. as group-by keys during shuffle), and a non-deterministic coder would produce inconsistent bytes for equal windows, breaking correctness. Note the message contains the long-standing typo 'determanistic'.
Source
Thrown at sdks/python/apache_beam/transforms/core.py:3894
environment_id: Environment where the current window_fn should be
applied in.
"""
global AccumulationMode, DefaultTrigger # pylint: disable=global-variable-not-assigned
# pylint: disable=wrong-import-order, wrong-import-position
from apache_beam.transforms.trigger import AccumulationMode
from apache_beam.transforms.trigger import DefaultTrigger
# pylint: enable=wrong-import-order, wrong-import-position
if triggerfn is None:
triggerfn = DefaultTrigger()
if accumulation_mode is None:
if triggerfn == DefaultTrigger():
accumulation_mode = AccumulationMode.DISCARDING
else:
raise ValueError(
'accumulation_mode must be provided for non-trivial triggers')
if not windowfn.get_window_coder().is_deterministic():
raise ValueError(
'window fn (%s) does not have a determanistic coder (%s)' %
(windowfn, windowfn.get_window_coder()))
self.windowfn = windowfn
self.triggerfn = triggerfn
self.accumulation_mode = accumulation_mode
self.allowed_lateness = Duration.of(allowed_lateness)
self.environment_id = environment_id
self.timestamp_combiner = (
timestamp_combiner or TimestampCombiner.OUTPUT_AT_EOW)
self._is_default = (
self.windowfn == GlobalWindows() and
self.triggerfn == DefaultTrigger() and
self.accumulation_mode == AccumulationMode.DISCARDING and
self.timestamp_combiner == TimestampCombiner.OUTPUT_AT_EOW and
self.allowed_lateness == 0)
def __repr__(self):
return "Windowing(%s, %s, %s, %s, %s)" % (View on GitHub (pinned to 12126d8942)
Solutions
- Implement a deterministic custom Coder for your window type (stable byte encoding for equal windows) and return it from get_window_coder().
- Replace float fields with int/Decimal or fixed-point representations in the window object.
- Sort any collection fields before encoding.
- Prefer built-in window functions (GlobalWindows, FixedWindows, SlidingWindows, Sessions) which ship deterministic coders.
Example fix
// before
class MyWindow: # coder inferred from float fields -> non-deterministic
...
pc | beam.WindowInto(MyWindowFn())
// after
class MyWindowFn(UserDefinedWindowFn):
def get_window_coder(self):
return DeterministicMyWindowCoder() # stable encoding
pc | beam.WindowInto(MyWindowFn()) Defensive patterns
Strategy: validation
Validate before calling
coder = windowfn.get_window_coder()
assert coder.is_deterministic(), f'{windowfn} coder {coder} is not deterministic' Try / catch
try:
pc | beam.WindowInto(custom_windowfn)
except ValueError as e:
log.error('Window coder issue: %s', e) Prevention
- Implement deterministic coders for custom window types
- Avoid float fields in window objects
- Prefer built-in WindowFn classes
- Sort collection fields before encoding
When it happens
Trigger: Passing a custom WindowFn whose get_window_coder() returns a non-deterministic coder (e.g. a coder over unsorted iterables or float fields) into beam.WindowInto or the Windowing transform.
Common situations: Custom IntervalWindow/GlobalWindow subclasses coded with an inferred coder based on floats or dicts; third-party window functions; coders affected by Python hash randomization for sets.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- Window coders must be deterministic.
- window_coder should not be None
- Unknown PaneInfo encoding 0x" + encoding.toString(16)
- Expected that the coder is deterministic
- the keyCoder of a GroupByEncryptedKey must be deterministic
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/d6620dbc7169edd8.
Report an issue: GitHub.