apache/beam · error · ValueError
Parameter name cannot be empty
Error message
Parameter name cannot be empty
What it means
When building a cross-language (Java) transform via SchemaTransform, each keyword argument to build() becomes a named schema field. Beam raises this ValueError if a keyword argument's name is empty, because a schema field cannot have an empty identifier.
Solutions
- Fix the source dict/config so every key is a non-empty parameter name.
- Filter out empty keys before calling build().
- Check for typos or failed string interpolation producing '' as a key.
Example fix
# before
builder.build(**{name: value for name, value in params.items() if name in keep}) # '' slips through
# after
builder.build(**{name: value for name, value in params.items() if name and name in keep}) Defensive patterns
Strategy: validation
Validate before calling
bad = [k for k in kwargs if not k]
if bad:
raise ValueError('empty parameter names: %r' % bad)
builder.build(**kwargs) Type guard
def valid_kwargs(kwargs) -> bool:
return all(isinstance(k, str) and k for k in kwargs) Try / catch
try:
builder.build(**kwargs)
except ValueError as e:
if 'Parameter name cannot be empty' in str(e):
kwargs = {k: v for k, v in kwargs.items() if k}
builder.build(**kwargs)
else:
raise Prevention
- Validate dynamically built kwargs keys before build().
- Never spread dicts with possibly-empty keys via **.
- Log the kwargs dict when building transforms programmatically.
When it happens
Trigger: Calling builder.build(**kwargs) where one of the kwargs keys is an empty string, typically via **{'': value} or dynamically constructed parameter names.
Common situations: Programmatically building kwargs from config dictionaries or parsed identifiers where a key was dropped or defaulted to empty string.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- An unsupported sink was specified
- At least one of --render_port or --render_output must be…
- buffer_sec must be >= 0, got
- Cannot skip negative number of header lines
- change_function must be 'CHANGES' or 'APPENDS', got
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/b3b028c4f65ff3a7.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/python/apache_beam/transforms/external.py:146
:return: ExternalConfigurationPayload
"""
raise NotImplementedError
def payload(self):
"""
The serialized ExternalConfigurationPayload
:return: bytes
"""
return self.build().SerializeToString()
def _get_schema_proto_and_payload(self, **kwargs):
named_fields = []
fields_to_values = OrderedDict()
for key, value in kwargs.items():
if not key:
raise ValueError('Parameter name cannot be empty')
if value is None:
raise ValueError(
'Received value None for key %s. None values are currently not '
'supported' % key)
named_fields.append(
(key, convert_to_typing_type(instance_to_type(value))))
fields_to_values[key] = value
schema_proto = named_fields_to_schema(named_fields)
row = named_tuple_from_schema(schema_proto)(**fields_to_values)
schema = named_tuple_to_schema(type(row))
payload = RowCoder(schema).encode(row)
return (schema_proto, payload)
class SchemaBasedPayloadBuilder(PayloadBuilder):
"""View on GitHub (pinned to 12126d8942)