Pipeline.connect() raises TypeError: object of type 'ellipsis' has no len() for Callable[..., T] sockets
Describe the bug
Connecting two components whose sockets are annotated with an Ellipsis callable type
(Callable[..., int], i.e. "a callable with an unspecified signature") crashes with a
TypeError from the standard library instead of being accepted or rejected by the type check.
The comparison treats the Ellipsis in get_args(Callable[..., int]) == (Ellipsis, int) as if it
were the parameter list and calls len() on it.
Error message
TypeError: object of type 'ellipsis' has no len()
Raised from haystack/core/type_utils.py in _check_callable_compatibility, through
_types_are_compatible inside Pipeline.connect().
To Reproduce
from typing import Callable
from haystack.core.component import component
from haystack.core.pipeline import Pipeline
@component
class Provider:
@component.output_types(handler=Callable[..., int])
def run(self):
return {"handler": lambda x: 1}
@component
class Consumer:
@component.output_types(value=int)
def run(self, handler: Callable[[int], int]):
return {"value": handler(1)}
pipe = Pipeline()
pipe.add_component("provider", Provider())
pipe.add_component("consumer", Consumer())
pipe.connect("provider.handler", "consumer.handler")
The same happens for the mirrored annotation, and the bare Callable sender hits the sibling
len() call on the other side of the same comparison.
Expected behavior
connect() should answer the compatibility question. Callable[..., int] spells its parameters as
"any signature", so it should be compared by return type only, rather than raising.
Environment
- Haystack:
main@4354727 - Python: 3.12 and 3.13 on Windows
test/core/test_type_utils.pypasses onmain; the file has noCallable[...](Ellipsis) case, which is why the path is uncovered.
FAQ Check
- [x] Have you had a look at our new FAQ page?
Duplicate of #12897. My tooling retried a create call that had already succeeded; closing the extra copies. No action needed here.