apache/beam · error · ValueError

cannot specify "name" without "path

Error message

{transform_name} cannot specify "name" without "path"

What it means

The mirror case of the previous check: an external callable requires both `path` and `name`. This ValueError fires when `name` is given but `path` is missing, so Beam cannot locate the file containing the named symbol.

Solutions

  1. Add the `path` key pointing to the module file that defines the function.
  2. Ensure the path is relative to the pipeline/YAML file location as documented.
  3. If no file is involved, remove `name` and use an inline expression/callable instead.
  4. Check for typos in the `path` key.

Example fix

# before
config:
  name: my_udf
# after
config:
  path: ./myfuncs.py
  name: my_udf
Defensive patterns

Strategy: validation

Validate before calling

if config.get('name') and not config.get('path'):
    raise ValueError('name requires path')

Prevention

When it happens

Trigger: Configuring a mapping transform with `name: my_udf` but omitting `path`, via _as_callable.

Common situations: Providing the function name but forgetting where it lives; copying only part of a path+name example; assuming name refers to an already-imported module member.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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

Appendix: source

Thrown at sdks/python/apache_beam/yaml/yaml_mapping.py:180

def _check_mapping_arguments(
    transform_name, expression=None, callable=None, name=None, path=None):
  # Argument checking
  if not expression and not callable and not path and not name:
    raise ValueError(
        f'{transform_name} must specify either "expression", "callable", '
        f'or both "path" and "name"')
  if expression and callable:
    raise ValueError(
        f'{transform_name} cannot specify both "expression" and "callable"')
  if (expression or callable) and (path or name):
    raise ValueError(
        f'{transform_name} cannot specify "expression" or "callable" with '
        f'"path" or "name"')
  if path and not name:
    raise ValueError(f'{transform_name} cannot specify "path" without "name"')
  if name and not path:
    raise ValueError(f'{transform_name} cannot specify "name" without "path"')


_THREAD_LOCAL_JS_CACHE = threading.local()


class _JsFunctionWrapper:
  def __init__(self, source_code, entrypoint_name):
    self.source_code = source_code
    self.entrypoint_name = entrypoint_name

  def _get_fn(self):
    cache = _THREAD_LOCAL_JS_CACHE
    if not hasattr(cache, 'functions'):
      cache.functions = {}

    cache_key = (self.source_code, self.entrypoint_name)
    if cache_key not in cache.functions:
      context = quickjs.Context()

View on GitHub (pinned to 12126d8942)