From 21547c8680974448eacb8abec5ec1b453e52ddb7 Mon Sep 17 00:00:00 2001 From: Mark Backman Date: Thu, 30 Apr 2026 09:41:43 -0400 Subject: [PATCH] fix(cartesia): stop double-yielding ErrorFrame on HTTP non-200 The non-200 branch yielded an ErrorFrame and then raised, which the outer except caught and yielded a second, less informative "Unknown error" frame. Return after the yield and fold the status code into the message. --- src/pipecat/services/cartesia/tts.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pipecat/services/cartesia/tts.py b/src/pipecat/services/cartesia/tts.py index f91fa90b5..c6c539e97 100644 --- a/src/pipecat/services/cartesia/tts.py +++ b/src/pipecat/services/cartesia/tts.py @@ -955,8 +955,10 @@ class CartesiaHttpTTSService(TTSService): async with self._session.post(url, json=payload, headers=headers) as response: if response.status != 200: error_text = await response.text() - yield ErrorFrame(error=f"Cartesia API error: {error_text}") - raise Exception(f"Cartesia API returned status {response.status}: {error_text}") + yield ErrorFrame( + error=f"Cartesia API error (status {response.status}): {error_text}" + ) + return audio_data = await response.read()