{"record":{"id":"8e4ae09cb51c9ed1","repo":"apache/beam","slug":"f-test-specification-identifier-has-unknown-attributes-list","errorCode":null,"errorMessage":"f'test specification {identifier} has unknown attributes {list(unknown_attrs)}'","messagePattern":"f'test specification (.+?) has unknown attributes (.+?)'","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/yaml/yaml_testing.py","lineNumber":169,"sourceCode":"        f'must be a list, got {type(test_spec[\"allowed_sources\"])}')\n\n  if (not test_spec.get('expected_outputs', []) and\n      not test_spec.get('expected_inputs', [])):\n    raise ValueError(\n        f'test specification {identifier} '\n        f'must have at least one expected_outputs or expected_inputs')\n\n  unknown_attrs = set(\n      yaml_transform.SafeLineLoader.strip_metadata(test_spec).keys()) - set([\n          '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:","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/yaml/yaml_testing.py#L151-L187","documentation":"validate_test_spec whitelists the allowed test-spec attributes (name, mock_inputs, mock_outputs, expected_outputs, expected_inputs, allowed_sources). Any unrecognized key raises a ValueError listing the unknown attributes, catching misspelled or unsupported options early.","triggerScenarios":"Including keys like 'expects', 'mockOutputs', or 'description' in a test spec; misspellings such as 'expected_output' (singular) or 'allow_sources'.","commonSituations":"Typos in attribute names, camelCase from copying JSON examples, or invented attributes assumed to be supported.","solutions":["Remove the unknown attributes or rename them to the supported set: name, mock_inputs, mock_outputs, expected_outputs, expected_inputs, allowed_sources.","Fix misspellings (e.g. expected_outputs not expected_output).","Check Beam YAML docs for the version's supported test-spec schema."],"exampleFix":"# before\n- name: my_test\n  expected_output:\n    out: [{id: 1}]\n\n# after\n- name: my_test\n  expected_outputs:\n    out: [{id: 1}]","handlingStrategy":"validation","validationCode":"ALLOWED = {'name','mock_inputs','mock_outputs','expected_outputs','expected_inputs','allowed_sources'}\nunknown = set(test_spec) - ALLOWED\nif unknown:\n    raise ValueError(f'unknown test attributes: {unknown}')","typeGuard":"def has_only_known_attrs(spec: dict) -> bool:\n    return set(spec) <= {'name','mock_inputs','mock_outputs','expected_outputs','expected_inputs','allowed_sources'}","tryCatchPattern":"try:\n    validate_test_spec(test_spec)\nexcept ValueError as e:\n    logging.error('Unknown test attributes: %s', e)\n    raise","preventionTips":["Use snake_case exactly as documented for test attributes","Keep a shared test-spec template with the six supported keys","Validate test specs with validate_test_spec in unit tests"],"tags":["python","apache-beam","yaml","testing","schema"],"backgroundTag":"schema-validation-failed","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}