apache/beam · error · ValueError

Received value None for key

Error message

Received value None for key %s. None values are currently not supported

What it means

SchemaTransform builder fields map Python values to schema-typed fields, and Beam does not know how to represent None as a typed field value in this path. Passing None as any keyword value to build() raises this ValueError with the offending key name.

Solutions

  1. Omit None-valued keys entirely instead of passing them (fields default when absent).
  2. Substitute explicit non-None defaults (e.g. '' , 0) when the schema expects a value.
  3. Filter kwargs: build(**{k: v for k, v in kwargs.items() if v is not None}).

Example fix

# before
builder.build(path=input_path, batch_size=None)
# after
builder.build(path=input_path)  # omit None fields; set defaults explicitly if required
Defensive patterns

Strategy: validation

Validate before calling

nones = [k for k, v in kwargs.items() if v is None]
if nones:
    raise ValueError('None values not supported for: %r' % nones)
builder.build(**kwargs)

Type guard

def no_none_values(kwargs) -> bool:
    return all(v is not None for v in kwargs.values())

Try / catch

try:
    builder.build(**kwargs)
except ValueError as e:
    if 'None values are currently not supported' in str(e):
        builder.build(**{k: v for k, v in kwargs.items() if v is not None})
    else:
        raise

Prevention

When it happens

Trigger: Calling builder.build(field=None) or passing a dict with None values via **kwargs to a SchemaTransform provider's build().

Common situations: Config-driven pipelines where optional settings are None by default, or merging partial configurations into kwargs.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/470bac02bb06e5c9. Report an issue: GitHub.

Appendix: source

Thrown at sdks/python/apache_beam/transforms/external.py:148

    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):
  """
  Base class for building payloads based on a schema that provides
  type information for each configuration value to encode.

View on GitHub (pinned to 12126d8942)