{"record":{"id":"5ef63b8028925162","repo":"apache/beam","slug":"f-attr-type-of-test-specification-identifier-must-be-a-list","errorCode":null,"errorMessage":"f'{attr_type} of test specification {identifier} must be a list, got {type(attr_type)}'","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":179,"sourceCode":"          'name',\n          'mock_inputs',\n          'mock_outputs',\n          'expected_outputs',\n          'expected_inputs',\n          'allowed_sources',\n      ])\n  if unknown_attrs:\n    raise ValueError(\n        f'test specification {identifier} '\n        f'has unknown attributes {list(unknown_attrs)}')\n\n  for attr_type in ('mock_inputs',\n                    'mock_outputs',\n                    'expected_outputs',\n                    'expected_inputs'):\n    attr = test_spec.get(attr_type, [])\n    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} '","sourceCodeStart":161,"sourceCodeEnd":197,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/yaml/yaml_testing.py#L161-L197","documentation":"A test specification attribute that must be a list of named element groups (mock_inputs, mock_outputs, expected_outputs, or expected_inputs) was supplied as some other type. validate_test_spec iterates these four attributes and this guard fires on the first one that is not a Python list, naming the offending attr_type and test identifier. Note the message interpolates type(attr_type) (the attribute name's type) rather than the actual value's type, so it always reports <class 'str'>.","triggerScenarios":"Thrown at sdks/python/apache_beam/yaml/yaml_testing.py:179 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set the offending attribute (e.g. mock_inputs) to a YAML/Python list of mappings, each with 'name' and 'elements' keys","If only one entry is needed, still wrap it in a list: mock_inputs: [{name: ..., elements: [...]}]","Check for YAML indentation errors that made the attribute parse as a scalar or map instead of a sequence"],"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-14T11:17:12.474Z"}