{"record":{"id":"efac13d9195ee7fd","repo":"apache/beam","slug":"transform-name-cannot-specify-path-without-name","errorCode":null,"errorMessage":"{transform_name} cannot specify \"path\" without \"name\"","messagePattern":"(.+?) cannot specify \"path\" without \"name\"","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/yaml/yaml_mapping.py","lineNumber":178,"sourceCode":"        config.get(param), input_fields, base_type == 'Filter', param)\n\n\ndef _check_mapping_arguments(\n    transform_name, expression=None, callable=None, name=None, path=None):\n  # Argument checking\n  if not expression and not callable and not path and not name:\n    raise ValueError(\n        f'{transform_name} must specify either \"expression\", \"callable\", '\n        f'or both \"path\" and \"name\"')\n  if expression and callable:\n    raise ValueError(\n        f'{transform_name} cannot specify both \"expression\" and \"callable\"')\n  if (expression or callable) and (path or name):\n    raise ValueError(\n        f'{transform_name} cannot specify \"expression\" or \"callable\" with '\n        f'\"path\" or \"name\"')\n  if path and not name:\n    raise ValueError(f'{transform_name} cannot specify \"path\" without \"name\"')\n  if name and not path:\n    raise ValueError(f'{transform_name} cannot specify \"name\" without \"path\"')\n\n\n_THREAD_LOCAL_JS_CACHE = threading.local()\n\n\nclass _JsFunctionWrapper:\n  def __init__(self, source_code, entrypoint_name):\n    self.source_code = source_code\n    self.entrypoint_name = entrypoint_name\n\n  def _get_fn(self):\n    cache = _THREAD_LOCAL_JS_CACHE\n    if not hasattr(cache, 'functions'):\n      cache.functions = {}\n\n    cache_key = (self.source_code, self.entrypoint_name)","sourceCodeStart":160,"sourceCodeEnd":196,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/yaml/yaml_mapping.py#L160-L196","documentation":"External callables loaded from a file require both `path` (file location) and `name` (symbol name). This ValueError fires when `path` is specified but `name` is missing, so the callable cannot be resolved from the file.","triggerScenarios":"Configuring a mapping transform with `path: ./funcs.py` but omitting `name`, via _as_callable.","commonSituations":"Assuming the file's single function is auto-discovered; truncating a config example that included both keys; key renamed or typo'd as `function` instead of `name`.","solutions":["Add the `name` key with the function name defined in the path file.","Verify the named function actually exists in the file at `path`.","Check for key typos (`function` vs `name`).","Alternatively drop `path` and use an inline expression/callable if no file is needed."],"exampleFix":"# before\nconfig:\n  path: ./myfuncs.py\n# after\nconfig:\n  path: ./myfuncs.py\n  name: my_udf","handlingStrategy":"validation","validationCode":"if config.get('path') and not config.get('name'):\n    raise ValueError('path requires name')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always specify path and name as a pair","Verify the named symbol exists in the target file","Watch for key typos like 'function'"],"tags":["yaml","beam-yaml","argument-validation"],"backgroundTag":"missing-required-argument","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}