{"record":{"id":"e1b82b6abd9e4ed1","repo":"apache/beam","slug":"source-info-must-a-three-tuple-where-firstitem-of-the-tuple","errorCode":null,"errorMessage":"source_info must a three tuple where firstitem of the tuple gives a iobase.BoundedSource. Received: %r","messagePattern":"source_info must a three tuple where firstitem of the tuple gives a iobase\\.BoundedSource\\. Received: %r","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/io/source_test_utils.py","lineNumber":155,"sourceCode":"\n  \"\"\"\n\n  if not (isinstance(reference_source_info, tuple) and\n          len(reference_source_info) == 3 and\n          isinstance(reference_source_info[0], iobase.BoundedSource)):\n    raise ValueError(\n        'reference_source_info must a three-tuple where first'\n        'item of the tuple gives a '\n        'iobase.BoundedSource. Received: %r' % reference_source_info)\n  reference_records = read_from_source(*reference_source_info)\n\n  source_records = []\n  for source_info in sources_info:\n    assert isinstance(source_info, tuple)\n    assert len(source_info) == 3\n    if not (isinstance(source_info, tuple) and len(source_info) == 3 and\n            isinstance(source_info[0], iobase.BoundedSource)):\n      raise ValueError(\n          'source_info must a three tuple where first'\n          'item of the tuple gives a '\n          'iobase.BoundedSource. Received: %r' % source_info)\n    if (type(reference_source_info[0].default_output_coder())\n        != type(source_info[0].default_output_coder())):\n      raise ValueError(\n          'Reference source %r and the source %r must use the same coder. '\n          'They are using %r and %r respectively instead.' % (\n              reference_source_info[0],\n              source_info[0],\n              type(reference_source_info[0].default_output_coder()),\n              type(source_info[0].default_output_coder())))\n    source_records.extend(read_from_source(*source_info))\n\n  if len(reference_records) != len(source_records):\n    raise ValueError(\n        'Reference source must produce the same number of records as the '\n        'list of sources. Number of records were %d and %d instead.' %","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/io/source_test_utils.py#L137-L173","documentation":"In assert_sources_equal_reference_source, each entry in sources_info must be a three-element tuple whose first element is an iobase.BoundedSource. Beam raises ValueError for any entry failing this shape, since it unpacks each tuple to read and split the source during comparison.","triggerScenarios":"Passing (source, options) two-tuples, lists, or non-BoundedSource objects inside the sources_info list to assert_sources_equal_reference_source.","commonSituations":"Same as the reference-source variant: forgetting the desired_bundle_size element, or accidentally passing legacy custom sources into a BoundedSource test helper.","solutions":["Make each sources_info entry a 3-tuple: (bounded_source, read_options, desired_bundle_size)","Verify each first element subclasses iobase.BoundedSource","Remove or fix malformed entries in the list","Use a consistent helper in tests that always builds the 3-tuple"],"exampleFix":"// before\nassert_sources_equal_reference_source(ref, [(src, options)])\n// after\nassert_sources_equal_reference_source(ref, [(src, options, 1000)])","handlingStrategy":"type-guard","validationCode":"from apache_beam.io import iobase\nassert all(isinstance(s, tuple) and len(s) == 3 and isinstance(s[0], iobase.BoundedSource) for s in sources_info)","typeGuard":"def is_valid_source_info(info):\n    return isinstance(info, tuple) and len(info) == 3 and isinstance(info[0], iobase.BoundedSource)","tryCatchPattern":"try:\n    source_test_utils.assert_sources_equal_reference_source(ref, sources)\nexcept ValueError as e:\n    logger.error('Bad candidate source entry: %s', e)","preventionTips":["Use one factory function to construct all sources_info tuples in tests","Check each list entry, not just the reference source","Convert legacy sources to BoundedSource subclasses"],"tags":["apache-beam","python","testing"],"backgroundTag":"invalid-argument-format","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"}