livekit.agents._exceptions.APIError: no audio fram...
# ask-ai
e
livekit.agents._exceptions.APIError: no audio frames were pushed for text continiously getting this error, can you please checky why ?
t
Thanks for reaching out, Aditya. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I’m sorry you’re hitting this continuously. I’m responding to the error:
livekit.agents._exceptions.APIError: no audio frames were pushed for text
. I don’t have a direct cause for that exact error available, so I’ll need a bit more context to diagnose and give a concrete fix. I can guide you through likely areas to check and then troubleshoot further once you share details. To help me reproduce and diagnose, please share the following: 1. What part of the Agents API is raising this error? ◦ Are you using a built-in pipeline agent (TTS pipeline, STT pipeline, conversation agent), or a custom agent/node? 1. The code path that triggers the error ◦ The minimal code snippet that calls the API or pushes audio frames (or the sequence of API calls). ◦ If possible, include where you create the audio source / TTS call and where you push frames. 1. Runtime details and full stack trace ◦ The full exception stack trace (not just the single line). ◦ Any logs around the time the error appears. 1. Audio/TTS specifics ◦ Are you using LiveKit’s TTS models or a third-party TTS? Which model? ◦ How are audio frames generated (microphone capture, file, TTS output)? ◦ Format and sampling details (sample rate, channels, PCM float/int16). 1. AudioSource / queue configuration ◦ If you’re using an
AudioSource
or similar, what are your
queue_size_ms
and related settings? ◦ Any recent changes to those settings or to network/latency behavior. 1. Repro steps and frequency ◦ Does the error happen for every request, only when sending certain text, or intermittently? ◦ Can you reliably reproduce it with a short example text? Quick things to check while you gather that info • Ensure your pipeline actually pushes audio frames before/after the TTS call returns (TTS must produce frames that get queued). • Verify the TTS step produced non-empty audio (filesize > 0, duration > 0). • Confirm audio format matches what LiveKit expects (sample rate, mono/stereo). • If you’re converting or resampling audio, validate the conversion isn’t producing silent frames or dropping frames. • Look at the audio queue behavior: if
queue_size_ms
is too small, frames might be dropped before they’re consumed. What I’ll do after you reply • If you share the code snippet + stack trace I’ll point to the exact line/step likely failing and give a targeted fix. • If it’s a configuration/audio-format issue I’ll show the precise sample-rate/format expectations and an example conversion. • If it’s related to TTS producing no output, I’ll give steps to validate the TTS output and integrate it into the agent pipeline correctly. If you prefer, paste the minimal failing code and stack trace here and I’ll walk through it line-by-line. Sources: Text and transcriptions | LiveKit Documentation | Text-to-speech (TTS) models overview | LiveKit Documentation | Resolving "InvalidState - failed to capture frame" errors in AudioSource | ...
e
its the tts part that is failing and i m using vertex ai chirp hd voices
t
Thanks — that helps. You mentioned the TTS part is failing and you’re using Vertex AI Chirp HD voices. I don’t have a direct cause for the exact error message, so let’s narrow it down so I can give a targeted fix. I’m responding to: “livekit.agents._exceptions.APIError: no audio frames were pushed for text” when using Vertex AI Chirp HD TTS. Please provide the following so I can diagnose: 1. Minimal code snippet showing how you call the TTS step and how you pass/send the resulting audio into the LiveKit agent pipeline (the TTS node/plugin usage and any AudioSource code). 2. Full stack trace for the exception (complete error output and any adjacent logs). 3. How you receive audio from Vertex AI: ◦ Are you receiving raw PCM, encoded audio (e.g., WAV/MP3/OGG), or base64 chunks over WebSocket/HTTP? ◦ Example of the first few bytes or metadata (sample rate, channels, bit depth). 1. How you convert or feed that audio into LiveKit: ◦ Any conversion/resampling code (ffmpeg, libs), and the exact sample rate/channels you output. ◦ The
queue_size_ms
or other AudioSource settings you’re using (if applicable). 1. Repro details: ◦ Does this happen for every text string, or only certain inputs? ◦ Can you reproduce it with a very short text (e.g., “hello”)? 1. Environment: ◦ Are you running the agent pipeline locally, in a container, or on a cloud VM? ◦ Any recent changes (library upgrades, network, or config changes)? Quick checks you can try immediately • Verify TTS produced non-empty audio (file size > 0 and playback is audible). • If Vertex returns encoded audio (MP3/OGG/WAV), decode to raw PCM and confirm sample rate and channels match what LiveKit expects. • Increase the
queue_size_ms
on your AudioSource if you use one — small queues can drop frames before they’re consumed. • Log the number of frames/bytes you push after TTS; if it’s zero, the TTS step didn’t produce audio. • Confirm you’re pushing audio frames to the same session/stream the agent expects (no wrong stream/ID mismatch). What I’ll do once you share the items above • Identify whether the problem is: TTS returning no audio, audio-format mismatch, conversion dropping frames, or the agent’s audio queue dropping frames. • Give exact code fixes (conversion example, sample rate settings, queue_size_ms tweak) and a minimal reproducible example you can run. Paste your minimal code + stack trace and I’ll walk through it line-by-line and propose a concrete fix. Sources: Google Cloud TTS integration guide | LiveKit Documentation | Pipeline nodes and hooks | LiveKit Documentation | examples/voice_agents | livekit/livekit_composite | DeepWiki | Resolving "InvalidState - failed to capture frame" errors in AudioSource | ... | Resolving "InvalidState - failed to capture frame" errors in AudioSource
e
queue_size_ms how do i increase this ?
t
Thanks — I’ll show you how to increase
queue_size_ms
so your TTS audio frames have more buffer and are less likely to be dropped. What to change • Set
queue_size_ms
when you create the
AudioSource
used to push TTS audio frames. • Start with a larger value (e.g., 1000–2000 ms) and increase incrementally if you still see dropped frames. Python example
Copy code
from livekit import rtc

audio_source = rtc.AudioSource(
    sample_rate=44100,    # match your TTS output sample rate
    num_channels=1,       # mono or 2 for stereo depending on your audio
    queue_size_ms=2000    # increase buffer to 2000ms
)
Notes and tips • Minimum allowed value is 10 ms. For streaming/synthesized TTS you’ll typically want 1000–2000 ms. • Make sure your TTS output sample rate and channel count match the
AudioSource
settings (mismatch can effectively produce "no frames"). • Push frames asynchronously and log the number/size of frames you push to confirm non-zero audio is being queued. • If you still see the error after increasing the queue, paste the code that pushes frames and the full stack trace and I’ll help pinpoint the next step. If you tell me which language/SDK you’re using (Python, Node, etc.) I can give a snippet for that environment. Sources: Resolving "InvalidState - failed to capture frame" errors in AudioSource | Resolving "InvalidState - failed to capture frame" errors in AudioSource | ... | Text-to-speech (TTS) models overview | LiveKit Documentation