From 50cc01a578c0f66f478eaf1a7c2f97dad315df25 Mon Sep 17 00:00:00 2001 From: Mark Backman Date: Tue, 10 Mar 2026 11:25:59 -0400 Subject: [PATCH] Guard against None context ID in append_to_audio_context After interruption, both _playing_context_id and _turn_context_id are None. If a subclass calls append_to_audio_context(None, frame), the recovery path matches (None == None) and creates a bogus audio context that blocks the handler from ever processing the real context. Early-return when context_id is falsy to prevent this. --- src/pipecat/services/tts_service.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pipecat/services/tts_service.py b/src/pipecat/services/tts_service.py index db695fd52..3c0161fa5 100644 --- a/src/pipecat/services/tts_service.py +++ b/src/pipecat/services/tts_service.py @@ -1182,6 +1182,9 @@ class TTSService(AIService): context_id: The context to append audio to. frame: The audio or control frame to append. """ + if not context_id: + logger.debug(f"{self} unable to append audio to context: no context ID provided") + return if self.audio_context_available(context_id): logger.trace(f"{self} appending audio {frame} to audio context {context_id}") await self._audio_contexts[context_id].put(frame)