From a13c4d12486f9323a8ed885408e79a844844a6a2 Mon Sep 17 00:00:00 2001 From: Mark Backman Date: Thu, 26 Mar 2026 15:28:19 -0400 Subject: [PATCH] Narrow ServiceSwitcher error check to active service only Only trigger handle_error for ErrorFrames originating from the active service, not any managed service. This prevents edge cases where errors from a non-active service could incorrectly trigger failover. --- src/pipecat/pipeline/service_switcher.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/pipecat/pipeline/service_switcher.py b/src/pipecat/pipeline/service_switcher.py index 91a665236..9d2e2a56e 100644 --- a/src/pipecat/pipeline/service_switcher.py +++ b/src/pipecat/pipeline/service_switcher.py @@ -313,12 +313,10 @@ class ServiceSwitcher(ParallelPipeline, Generic[StrategyType]): if frame.service_name != self.strategy.active_service.name: return - # Let the strategy react to non-fatal errors from the active service. - # We check that the error originated from one of our managed services - # to avoid reacting to errors that are just propagating upstream - # through the pipeline from downstream processors. + # Let the strategy react to non-fatal errors from the active service, + # ignoring errors just propagating upstream from other processors. if isinstance(frame, ErrorFrame) and not frame.fatal: - if frame.processor and frame.processor in self._services: + if frame.processor and frame.processor == self.strategy.active_service: await self.strategy.handle_error(frame) await super().push_frame(frame, direction)