apache/beam · error · ValueError
Only const and zipf distributions are supported for…
Error message
Only const and zipf distributions are supported for determining sizes of bundles produced by initial splitting. Received: %s
What it means
SyntheticSource.__init__ supports only 'const' and 'zipf' distributions for the bundle sizes produced by initial splitting; anything else raises ValueError. It reads input_spec['bundleSizeDistribution']['type'] (defaulting to 'const' when absent).
Solutions
- Set bundleSizeDistribution.type to 'const' or 'zipf'
- Remove the bundleSizeDistribution key entirely to get the default 'const' behavior
- Fix casing/typos — values must match exactly
Example fix
// before
"bundleSizeDistribution": {"type": "uniform", "seed": 7}
// after
"bundleSizeDistribution": {"type": "zipf", "seed": 7} Defensive patterns
Strategy: validation
Validate before calling
t = input_spec.get('bundleSizeDistribution', {}).get('type', 'const')
if t not in ('const', 'zipf'):
raise ValueError(f'unsupported bundleSizeDistribution type: {t}') Type guard
def is_supported_splitting(t):
return t in ('const', 'zipf') Try / catch
try:
source = SyntheticSource(spec)
except ValueError as e:
_LOGGER.error('%s; falling back to const splitting', e)
spec.pop('bundleSizeDistribution', None)
source = SyntheticSource(spec) Prevention
- Only emit const/zipf in spec generators
- Normalize type strings (lowercase/strip) at load time
- Validate the parse-spec JSON against a schema before running
When it happens
Trigger: Passing a pipeline parse spec where bundleSizeDistribution.type is 'uniform', 'normal', or any other unsupported name.
Common situations: Reusing a spec JSON written for another synthetic generator with more distribution options; typo ('Zipf', 'constant'); experimenting with distributions not implemented in this module.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- Invalid secret type , currently only GcpSecret and…
- Unknown algorithm . Supported algorithms are "builtin" or…
- Unknown enrichment source
- Unknown language for mapping transform
- Unsupported watermark_policy:
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/60192ed252d47025.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/python/apache_beam/testing/synthetic_pipeline.py:361
Raises:
ValueError: if input parameters are invalid.
"""
def maybe_parse_byte_size(s):
return parse_byte_size(s) if isinstance(s, str) else int(s)
self._num_records = input_spec['numRecords']
self._key_size = maybe_parse_byte_size(input_spec.get('keySizeBytes', 1))
self._hot_key_fraction = input_spec.get('hotKeyFraction', 0)
self._num_hot_keys = input_spec.get('numHotKeys', 0)
self._value_size = maybe_parse_byte_size(
input_spec.get('valueSizeBytes', 1))
self._total_size = self.element_size * self._num_records
self._initial_splitting = (
input_spec['bundleSizeDistribution']['type']
if 'bundleSizeDistribution' in input_spec else 'const')
if self._initial_splitting != 'const' and self._initial_splitting != 'zipf':
raise ValueError(
'Only const and zipf distributions are supported for determining '
'sizes of bundles produced by initial splitting. Received: %s',
self._initial_splitting)
self._initial_splitting_num_bundles = (
input_spec['forceNumInitialBundles']
if 'forceNumInitialBundles' in input_spec else 0)
if self._initial_splitting == 'zipf':
self._initial_splitting_distribution_parameter = (
input_spec['bundleSizeDistribution']['param'])
if self._initial_splitting_distribution_parameter < 1:
raise ValueError(
'Parameter for a Zipf distribution must be larger than 1. '
'Received %r.',
self._initial_splitting_distribution_parameter)
else:
self._initial_splitting_distribution_parameter = 0
self._dynamic_splitting = (
'none' if (View on GitHub (pinned to 12126d8942)