apache/beam · error · ValueError

Received value None. None values are currently not supported

Error message

Received value None. None values are currently not supported

What it means

Positional (unnamed) arguments passed to the Java class builder are converted to synthetic named fields with ignored names; None is not a supported field value in this schema-based path, so _args_to_named_fields raises this ValueError when any positional arg is None.

Solutions

  1. Replace None positional args with concrete default values (e.g. '', 0) matching the Java constructor signature.
  2. Omit trailing None args and use a different constructor overload via with_constructor with the non-None subset.
  3. Use named kwargs with with_constructor only for non-None values.

Example fix

# before
builder.with_constructor(path, None)  # RuntimeError path: None arg
# after
builder.with_constructor(path, "")  # or omit and choose an overload without the arg
Defensive patterns

Strategy: validation

Validate before calling

if any(a is None for a in args):
    raise ValueError('None positional args not supported; use concrete defaults')
builder.with_constructor(*args)

Type guard

def no_none_args(args) -> bool:
    return all(a is not None for a in args)

Try / catch

try:
    builder.with_constructor(*args)
except ValueError as e:
    if 'None values are currently not supported' in str(e):
        builder.with_constructor(*[a if a is not None else default_for(i) for i, a in enumerate(args)])
    else:
        raise

Prevention

When it happens

Trigger: Calling with_constructor(None, ...) or build with positional args containing None, e.g. JavaClassLookupPayloadBuilder(cls).with_constructor(None).

Common situations: Defaulting optional constructor arguments to None in wrapper code; programmatically generated argument lists containing placeholders.

Related errors


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

Appendix: source

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

  def __init__(self, class_name):
    """
    :param class_name: fully qualified name of the transform class.
    """
    if not class_name:
      raise ValueError('Class name must not be empty')

    self._class_name = class_name
    self._constructor_method = None
    self._constructor_param_args = None
    self._constructor_param_kwargs = None
    self._builder_methods_and_params = OrderedDict()

  def _args_to_named_fields(self, args):
    next_field_id = 0
    named_fields = OrderedDict()
    for value in args:
      if value is None:
        raise ValueError(
            'Received value None. None values are currently not supported')
      named_fields[(
          JavaClassLookupPayloadBuilder.IGNORED_ARG_FORMAT %
          next_field_id)] = value
      next_field_id += 1
    return named_fields

  def build(self):
    all_constructor_param_kwargs = self._args_to_named_fields(
        self._constructor_param_args)
    if self._constructor_param_kwargs:
      all_constructor_param_kwargs.update(self._constructor_param_kwargs)
    constructor_schema, constructor_payload = (
      self._get_schema_proto_and_payload(**all_constructor_param_kwargs))
    payload = external_transforms_pb2.JavaClassLookupPayload(
        class_name=self._class_name,
        constructor_schema=constructor_schema,
        constructor_payload=constructor_payload)

View on GitHub (pinned to 12126d8942)