{"record":{"id":"6d101b0bd167ad81","repo":"apache/beam","slug":"f-unmocked-output-tag-of-name-if-any-used-output-is-mocked","errorCode":null,"errorMessage":"f'Unmocked output {tag} of {name}.If any used output is mocked all used outputs must be mocked.'","messagePattern":"f'Unmocked output (.+?) of (.+?)\\.If any used output is mocked all used outputs must be mocked\\.'","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/yaml/yaml_testing.py","lineNumber":250,"sourceCode":"      return {\n          tag: require_output_or_outputs(input_ref)\n          for tag, input_ref in yaml_transform.empty_if_explicitly_empty(\n              input_spec).items()\n      }\n\n  def require_output(name: str) -> str:\n    # The same output may be referenced under different names.\n    # Normalize before we cache.\n    transform_id, tag = scope.get_transform_id_and_output_name(name)\n    return _require_output(transform_id, tag) or name\n\n  @functools.cache\n  def _require_output(transform_id: str, tag: str) -> Optional[str]:\n    if transform_id in mocked_outputs_by_id:\n      if tag not in mocked_outputs_by_id[transform_id]:\n        name = next(iter(\n            mocked_outputs_by_id[transform_id].values()))['name'].split('.')[0]\n        raise ValueError(\n            f'Unmocked output {tag} of {name}.'\n            'If any used output is mocked all used outputs must be mocked.')\n      return create_mocked_output(transform_id, tag)\n    else:\n      _use_transform(transform_id)\n      return None  # Use original name.\n\n  @functools.cache\n  def _use_transform(transform_id: str) -> None:\n    transform_spec = dict(scope.get_transform_spec(transform_id))\n    transform_spec['input'] = create_inputs(transform_id)\n    transforms.append(transform_spec)\n\n  @functools.cache\n  def create_mocked_input(transform_id: str) -> str:\n    transform = create_create(\n        f'MockInput[{mocked_inputs_by_id[transform_id][\"name\"]}]',\n        mocked_inputs_by_id[transform_id]['elements'],","sourceCodeStart":232,"sourceCodeEnd":268,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/yaml/yaml_testing.py#L232-L268","documentation":"Raised during test pipeline construction when a transform output is referenced but not covered by mocks. The mock-resolution helper _require_output found the transform in mocked_outputs_by_id but the specific output tag was absent from its mock set, and the rule enforced here is all-or-nothing: if any used output of a transform is mocked, every used output must be mocked. The input at fault is the unmocked output tag of the named transform.","triggerScenarios":"Thrown at sdks/python/apache_beam/yaml/yaml_testing.py:250 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add a mock_outputs entry for the missing output tag of that transform","If outputs are referenced by tag, name the mock entry 'transformName.tag' so it matches the unmocked tag","Alternatively remove the mock on the sibling output so the transform is treated as unmocked"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}