{"record":{"id":"900dc23b1cb43f8c","repo":"apache/beam","slug":"transform-name-cannot-specify-name-without-path","errorCode":null,"errorMessage":"{transform_name} cannot specify \"name\" without \"path\"","messagePattern":"(.+?) cannot specify \"name\" without \"path\"","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/yaml/yaml_mapping.py","lineNumber":180,"sourceCode":"\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)\n    if cache_key not in cache.functions:\n      context = quickjs.Context()","sourceCodeStart":162,"sourceCodeEnd":198,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/yaml/yaml_mapping.py#L162-L198","documentation":"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.","triggerScenarios":"Configuring a mapping transform with `name: my_udf` but omitting `path`, via _as_callable.","commonSituations":"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.","solutions":["Add the `path` key pointing to the module file that defines the function.","Ensure the path is relative to the pipeline/YAML file location as documented.","If no file is involved, remove `name` and use an inline expression/callable instead.","Check for typos in the `path` key."],"exampleFix":"# before\nconfig:\n  name: my_udf\n# after\nconfig:\n  path: ./myfuncs.py\n  name: my_udf","handlingStrategy":"validation","validationCode":"if config.get('name') and not config.get('path'):\n    raise ValueError('name requires path')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always specify path and name as a pair","Use paths relative to the pipeline file as documented","Test external callable loading in isolation"],"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"}