From 5bf2ace5d0b9ca1f8a7fca48b0afc5845e09b82d Mon Sep 17 00:00:00 2001 From: gabrielmbmb Date: Thu, 2 Oct 2025 11:33:56 +0200 Subject: [PATCH] catch `asyncio.CancelledError` exception --- src/pipecat/services/websocket_service.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pipecat/services/websocket_service.py b/src/pipecat/services/websocket_service.py index 17a9113667..87a63e7dc1 100644 --- a/src/pipecat/services/websocket_service.py +++ b/src/pipecat/services/websocket_service.py @@ -83,6 +83,9 @@ async def _receive_task_handler(self, report_error: Callable[[ErrorFrame], Await try: await self._receive_messages() retry_count = 0 # Reset counter on successful message receive + except asyncio.CancelledError: + logger.debug(f"{self} receive task cancelled") + break except ConnectionClosedOK as e: # Normal closure, don't retry logger.debug(f"{self} connection closed normally: {e}")