apache/beam · error · ValueError
Error parsing windowing config string at
Error message
Error parsing windowing config string at {identify_object(spec)}: {e} What it means
When config.windowing is supplied as a string, preprocess_windowing parses it with yaml.safe_load; any failure — invalid YAML syntax or the parsed value not being a dict — is wrapped in this ValueError with the transform's identity and the underlying exception message. It exists to give context about which transform's windowing config is broken.
Solutions
- Fix the YAML/JSON syntax indicated by the wrapped exception e in the message.
- Prefer expressing windowing as a native mapping in the spec to avoid string parsing entirely.
- Validate the string with yaml.safe_load locally to see the exact parse error.
Example fix
# before
config:
windowing: "{type: fixed, size: }"
# after
config:
windowing:
type: fixed
size: 10s Defensive patterns
Strategy: try-catch
Validate before calling
import yaml
w = spec.get('config', {}).get('windowing')
if isinstance(w, str):
try:
yaml.safe_load(w)
except yaml.YAMLError as err:
print(f'invalid windowing YAML: {err}') Try / catch
try:
spec = preprocess_windowing(spec)
except ValueError as e:
if 'Error parsing windowing config string' in str(e):
# e's cause shows the exact YAML/typing failure; fix and retry or surface
print(e)
raise Prevention
- Validate the windowing string with yaml.safe_load before submitting the pipeline
- Use block-style mappings instead of inline strings for multi-line configs
- Quote strings containing YAML special characters
When it happens
Trigger: preprocess_windowing on a spec whose windowing string is malformed YAML (e.g. 'type: fixed size:' unterminated) or parses to a non-dict (which first raises TypeError('Windowing config string must be a YAML/JSON map.') and is caught here and re-raised).
Common situations: Multi-line JSON strings with indentation errors; forgetting to quote a string containing YAML-special characters; typos in JSON like single quotes around keys in a JSON-style string.
Related errors
- f"Invalid windowing value ' '. Must provide numeric value.
- f'Unknown window type
- "Invalid windowing time unit ' '. Valid time units are .
- Windowing config string must be a YAML/JSON map.
- accumulation_mode must be provided for non-trivial triggers
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/4cd97dea8d7298c0.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/python/apache_beam/yaml/yaml_transform.py:1118
def preprocess_windowing(spec):
if spec['type'] == 'WindowInto':
# This is the transform where it is actually applied.
if 'windowing' in spec:
spec['config'] = spec.get('config', {})
spec['config']['windowing'] = spec.pop('windowing')
if spec.get('config', {}).get('windowing'):
windowing_config = spec['config']['windowing']
if isinstance(windowing_config, str):
try:
# PyYAML can load a JSON string - one-line and multi-line.
# Without this code, multi-line is not supported.
parsed_config = yaml.safe_load(windowing_config)
if not isinstance(parsed_config, dict):
raise TypeError('Windowing config string must be a YAML/JSON map.')
spec['config']['windowing'] = parsed_config
except Exception as e:
raise ValueError(
f'Error parsing windowing config string at \
{identify_object(spec)}: {e}') from e
return spec
elif 'windowing' not in spec:
# Nothing to do.
return spec
if spec['type'] == 'composite':
# Apply the windowing to any reads, creates, etc. in this transform
# TODO(robertwb): Better handle the case where a read is followed by a
# setting of the timestamps. We should be careful of sliding windows
# in particular.
spec = push_windowing_to_roots(spec)
windowing = spec.pop('windowing')
if not is_empty(spec['input']):
# Apply the windowing to all inputs by wrapping it in a transform that
# first applies windowing and then applies the original transform.View on GitHub (pinned to 12126d8942)