apache/beam · error · TypeError
f' of test specification must be an object, got
Error message
f'{attr_type} {ix} of test specification {identifier} must be an object, got {type(attr_item)}' What it means
One entry inside a mock_inputs/mock_outputs/expected_outputs/expected_inputs list is not a mapping. Each entry must be an object with at least a 'name' key and an 'elements' key; this guard fires when an entry (e.g. a bare string or number) cannot be treated as a per-input/output spec.
Solutions
- Make each list entry a mapping with 'name' and 'elements' keys, e.g. {name: input1, elements: [...]}
- Quote names that could be parsed as scalars and ensure YAML indentation places entries under the attribute list
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at sdks/python/apache_beam/yaml/yaml_testing.py:184 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/6bc950e0ba12d2f4.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/python/apache_beam/yaml/yaml_testing.py:184
'allowed_sources',
])
if unknown_attrs:
raise ValueError(
f'test specification {identifier} '
f'has unknown attributes {list(unknown_attrs)}')
for attr_type in ('mock_inputs',
'mock_outputs',
'expected_outputs',
'expected_inputs'):
attr = test_spec.get(attr_type, [])
if not isinstance(attr, list):
raise TypeError(
f'{attr_type} of test specification {identifier} '
f'must be a list, got {type(attr_type)}')
for ix, attr_item in enumerate(attr):
if not isinstance(attr_item, dict):
raise TypeError(
f'{attr_type} {ix} of test specification {identifier} '
f'must be an object, got {type(attr_item)}')
if 'name' not in attr_item:
raise TypeError(
f'{attr_type} {ix} of test specification {identifier} '
f'missing a name')
if 'elements' not in attr_item:
raise TypeError(
f'{attr_type} {ix} of test specification {identifier} '
f'missing a elements')
if not isinstance(attr_item['elements'], list):
raise TypeError(
f'{attr_type} {ix} of test specification {identifier} '
f'must be a list, got {type(attr_item["elements"])}')
def inject_test_tranforms(spec, test_spec, fix_failures):
validate_test_spec(test_spec)View on GitHub (pinned to 12126d8942)