In InputSocket.__post_init__, line 100 calls get_args(get_args(self.type)[0])[0] to unwrap the inner type from a Variadic / GreedyVariadic annotation. This assumes the wrapped type is always a subscripted generic (e.g. Iterable[int]), but if a developer annotates a run-method parameter with a bare Annotated[Iterable, HAYSTACK_VARIADIC_ANNOTATION] — using Iterable without a type argument — then get_args(Iterable) returns an empty tuple (), and the unconditional [0] index raises IndexError: tuple index out of range.
This crash surfaces at component instantiation time (not import time), so it bypasses static type checking and takes down the whole component construction.
Reproduction:
from typing import Annotated
from collections.abc import Iterable
from haystack import component
from haystack.core.component.types import HAYSTACK_VARIADIC_ANNOTATION
@component
class BadJoiner:
@component.output_types(result=str)
def run(self, inputs: Annotated[Iterable, HAYSTACK_VARIADIC_ANNOTATION]):
return {"result": ""}
j = BadJoiner() # IndexError: tuple index out of range
Expected: a clear ComponentError explaining that a type argument is required, e.g. Variadic[int].
In
InputSocket.__post_init__, line 100 callsget_args(get_args(self.type)[0])[0]to unwrap the inner type from aVariadic/GreedyVariadicannotation. This assumes the wrapped type is always a subscripted generic (e.g.Iterable[int]), but if a developer annotates a run-method parameter with a bareAnnotated[Iterable, HAYSTACK_VARIADIC_ANNOTATION]— usingIterablewithout a type argument — thenget_args(Iterable)returns an empty tuple(), and the unconditional[0]index raisesIndexError: tuple index out of range.This crash surfaces at component instantiation time (not import time), so it bypasses static type checking and takes down the whole component construction.
Reproduction:
Expected: a clear
ComponentErrorexplaining that a type argument is required, e.g.Variadic[int].