{"record":{"id":"96de510584d119c6","repo":"apache/beam","slug":"f-attr-type-ix-of-test-specification-identifier-must-be-a","errorCode":null,"errorMessage":"f'{attr_type} {ix} of test specification {identifier} must be a list, got {type(attr_item[\"elements\"])}'","messagePattern":"f'(.+?) (.+?) of test specification (.+?) must be a list, got (.+?)'","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/yaml/yaml_testing.py","lineNumber":196,"sourceCode":"    if not isinstance(attr, list):\n      raise TypeError(\n          f'{attr_type} of test specification {identifier} '\n          f'must be a list, got {type(attr_type)}')\n    for ix, attr_item in enumerate(attr):\n      if not isinstance(attr_item, dict):\n        raise TypeError(\n            f'{attr_type} {ix} of test specification {identifier} '\n            f'must be an object, got {type(attr_item)}')\n      if 'name' not in attr_item:\n        raise TypeError(\n            f'{attr_type} {ix} of test specification {identifier} '\n            f'missing a name')\n      if 'elements' not in attr_item:\n        raise TypeError(\n            f'{attr_type} {ix} of test specification {identifier} '\n            f'missing a elements')\n      if not isinstance(attr_item['elements'], list):\n        raise TypeError(\n            f'{attr_type} {ix} of test specification {identifier} '\n            f'must be a list, got {type(attr_item[\"elements\"])}')\n\n\ndef inject_test_tranforms(spec, test_spec, fix_failures):\n  validate_test_spec(test_spec)\n  scope = yaml_transform.LightweightScope(spec['transforms'])\n\n  mocked_inputs_by_id = {\n      scope.get_transform_id(mock_input['name']): mock_input\n      for mock_input in test_spec.get('mock_inputs', [])\n  }\n\n  mocked_outputs_by_id = _composite_key_to_nested({\n      scope.get_transform_id_and_output_name(mock_output['name']): mock_output\n      for mock_output in test_spec.get('mock_outputs', [])\n  })\n","sourceCodeStart":178,"sourceCodeEnd":214,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/yaml/yaml_testing.py#L178-L214","documentation":"The 'elements' field of a test-spec entry is present but is not a list. Elements must be a sequence of row values (mappings or scalars); this guard fires when it was parsed as a scalar or mapping, and reports the actual type of attr_item['elements'].","triggerScenarios":"Thrown at sdks/python/apache_beam/yaml/yaml_testing.py:196 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Wrap the element rows in a list: elements: [{col: val}, ...]","Fix YAML indentation so each element is a list item under 'elements'"],"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"}