{"record":{"id":"1c5694e5bc0b6460","repo":"apache/beam","slug":"ellipsis-can-only-be-used-to-type-hint-an-arbitrary-length","errorCode":null,"errorMessage":"Ellipsis can only be used to type-hint an arbitrary length tuple of containing a single type: Tuple[A, ...].","messagePattern":"Ellipsis can only be used to type-hint an arbitrary length tuple of containing a single type: Tuple\\[A, \\.\\.\\.\\]\\.","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/typehints/typehints.py","lineNumber":769,"sourceCode":"      return bindings\n\n    def bind_type_variables(self, bindings):\n      bound_tuple_types = tuple(\n          bind_type_variables(t, bindings) for t in self.tuple_types)\n      if bound_tuple_types == self.tuple_types:\n        return self\n      return Tuple[bound_tuple_types]\n\n  def __getitem__(self, type_params):\n    ellipsis = False\n\n    if not isinstance(type_params, abc.Iterable):\n      # Special case for hinting tuples with arity-1.\n      type_params = (type_params, )\n\n    if type_params and type_params[-1] == Ellipsis:\n      if len(type_params) != 2:\n        raise TypeError(\n            'Ellipsis can only be used to type-hint an arbitrary '\n            'length tuple of containing a single type: '\n            'Tuple[A, ...].')\n      # Tuple[A, ...] indicates an arbitary length homogeneous tuple.\n      type_params = type_params[:1]\n      ellipsis = True\n\n    for t in type_params:\n      validate_composite_type_param(\n          t, error_msg_prefix='All parameters to a Tuple hint')\n\n    if ellipsis:\n      return self.TupleSequenceConstraint(type_params[0])\n    return self.TupleConstraint(type_params)\n\n\nTupleConstraint = TupleHint.TupleConstraint\nTupleSequenceConstraint = TupleHint.TupleSequenceConstraint","sourceCodeStart":751,"sourceCodeEnd":787,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/typehints/typehints.py#L751-L787","documentation":"Raised by Tuple.__getitem__ when Ellipsis appears anywhere but as the sole second parameter of a 2-element parameter list. Ellipsis is only valid in the exact form Tuple[A, ...] for homogeneous arbitrary-length tuples.","triggerScenarios":"Tuple[int, str, ...]; Tuple[...] or Ellipsis not last; more than one Ellipsis.","commonSituations":"Developers assuming Ellipsis means 'more of anything' at the end, mimicking typing.Tuple[int, ...] misuse or mixing heterogeneous and varargs forms.","solutions":["Use Tuple[A, ...] exactly: one type then Ellipsis","For heterogeneous trailing values, enumerate every type explicitly, e.g. Tuple[int, str, str]","For mixed arbitrary content use Tuple[Any, ...] or List[Any]"],"exampleFix":"# before\nTuple[int, str, ...]\n# after\nTuple[int, str, str]  # or Tuple[Any, ...]","handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only use Ellipsis in the exact Tuple[A, ...] form","Prefer explicit arities for heterogeneous tuples","Reach for Tuple[Any, ...] when content is genuinely arbitrary"],"tags":["python","apache-beam","type-hints","tuple","ellipsis"],"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"}