-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Closed
Labels
P1High priority, add to the next sprintHigh priority, add to the next sprinttype:bugSomething isn't workingSomething isn't working
Milestone
Description
When a Haystack pipeline component raises an exception during execution, it triggers a RecursionError: maximum recursion depth exceeded instead of properly propagating the original exception. This issue is specifically triggered when data containing Python Enum values is passed between components.
Steps to Reproduce
Create a pipeline with at least two connected components
Have the first component output data containing an Enum value
Have the second component raise an exception during its run() method
Execute the pipeline
You will get
RecursionError: maximum recursion depth exceeded
Minimal Reproducible Example
from enum import Enum
from typing import List, Dict
from haystack import Pipeline, component
from haystack.dataclasses import Document
class SomeEnum(Enum):
ONE = "one"
TWO = "two"
@component
class TextProcessor:
def __init__(self, prefix: str = "PROCESSED"):
self.prefix = prefix
@component.output_types(documents=List[Document], data=List[Dict])
def run(self, documents: List[Document]) -> Dict[str, any]:
# Critical: data contains an Enum value
return {"documents": [], "data": [{"key": SomeEnum.ONE}]}
@component
class ContentEnricher:
@component.output_types(documents=List[Document])
def run(self, documents: List[Document], data: List[Dict]) -> Dict[str, List[Document]]:
raise Exception("fail")
# Build pipeline
pipeline = Pipeline()
pipeline.add_component("text_processor", TextProcessor(prefix="DEMO"))
pipeline.add_component("content_enricher", ContentEnricher())
pipeline.connect("text_processor.documents", "content_enricher.documents")
pipeline.connect("text_processor.data", "content_enricher.data")
# Run pipeline - triggers RecursionError
result = pipeline.run({"text_processor": {"documents": []}})
Metadata
Metadata
Assignees
Labels
P1High priority, add to the next sprintHigh priority, add to the next sprinttype:bugSomething isn't workingSomething isn't working