I am getting this error Traceback (most recent cal...
# ask-ai
f
I am getting this error Traceback (most recent call last): File "/app/.venv/lib/python3.13/site-packages/livekit/agents/utils/log.py", line 16, in async_fn_logs return await fn(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.13/site-packages/livekit/agents/voice/generation.py", line 254, in _text_forwarding_task async for delta in source: ...<5 lines>... out.first_text_fut.set_result(None) File "/app/.venv/lib/python3.13/site-packages/livekit/agents/voice/agent.py", line 442, in transcription_node async for delta in text: ^^^^ TypeError: 'async for' requires an object with aiter method, got NoneType
t
Thanks for reaching out, Vishalli. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
You're seeing this error because the
transcription_node
is doing
async for delta in text
, but
text
is None. That happens when the TTS node in your pipeline returned None instead of an async iterable of audio frames. What you can do: 1. Check whether you overrode
tts_node
. If you did, ensure it always returns an async iterable of
rtc.AudioFrame
(never None). 2. If you call
Agent.default.tts_node(...)
, guard against None and return an empty async generator instead. Example pattern:
Copy code
async def tts_node(self, text: AsyncIterable[str], model_settings: ModelSettings) -> AsyncIterable[rtc.AudioFrame]:
    audio_stream = Agent.default.tts_node(self, text, model_settings)
    if audio_stream is None:
        async def empty_stream():
            if False:
                yield
        return empty_stream()
    async for frame in audio_stream:
        yield frame
1. Add logging where you call the default TTS to confirm whether it returned None and why (model load failure, config issue, etc.). Could you tell me whether you overrode
tts_node
or are using the default TTS? If you share the
tts_node
implementation (or the code that invokes
Agent.default.tts_node
), I can point out the exact place to fix. Sources: Pipeline nodes and hooks | LiveKit docs
f
default tts
t
Thanks — since you're using the default TTS, the error means the default TTS call returned None and that None propagated into
transcription_node
. I can help pinpoint the cause. Quick questions: • Are you using any custom Agent config or model settings (language, model name, or provider) when calling TTS? • Do you see any earlier logs or errors about model loading, authentication, or TTS failures before the TypeError? • Which LiveKit Agents version are you running? • Can you share the code snippet where you construct/run the agent pipeline or where
tts_node
is invoked (the few lines that call or configure TTS)? With those details I’ll tell you the minimal change to guard the default TTS return and where to add logging to capture the underlying failure.
f
1.0.18
t
Thanks — you're on LiveKit Agents 1.0.18. That helps. What to check next (quick, in-order steps): 1. Inspect logs for earlier TTS errors • Search logs just before the TypeError for messages about model loading, authentication, or TTS failures. The default TTS returning None is usually preceded by a failure when selecting or initializing a TTS provider or model. 1. Confirm TTS-related config you pass to the Agent • Share any model/provider settings you pass (language, model name, provider credentials). Missing or incorrect provider/model config commonly causes the default TTS to return None. 1. Add a defensive guard where the default TTS is invoked • Wrap the call to
Agent.default.tts_node(...)
and log if it returns None, then return an empty async generator so downstream
async for
doesn't get None. Example pattern:
Copy code
audio_stream = Agent.default.tts_node(self, text, model_settings)
if audio_stream is None:
    async def empty_stream():
        if False:
            yield
    return empty_stream()
1. Try a minimal repro • Run a small agent pipeline with default settings (no custom model/provider) to see if TTS works. If it works there, the issue is in your custom config. 1. Consider updating if applicable • If you can test on a newer Agents build (if available to you), that may include more logging and fixes around TTS initialization. If you want, share: • The model/provider settings you pass to the Agent (language, model name, provider), and • Any log lines appearing just before the TypeError. With those I’ll point to the exact field to fix or the log message to investigate further.
f
on phne calls, it is working , but when i try to implement that for web call in flutter
t
You're seeing TTS return None only for web calls in Flutter while phone calls work. That strongly suggests an environment/config difference between your web flow and phone flow. To narrow this down, please answer/provide the following: 1. How are you initiating the Agent pipeline for web vs phone? Share the code snippet that constructs/runs the agent pipeline (the lines that set model/provider settings and call TTS) used for the Flutter web call. 2. Any TTS-related config differences between web and phone (model name, language, provider credentials)? 3. Server logs from just before the TypeError when you run a web call (search for model load, provider auth, or TTS errors) — paste the few lines immediately preceding the TypeError. 4. Are you proxying or routing audio differently for web (e.g., using WebRTC relay, different media tracks, or different request headers)? 5. Which browser and Flutter web build mode (debug/release) did you test with? What I’ll do once you share those: point out the exact place where default TTS returns None, show the minimal guard to return an empty async generator, and highlight the likely root cause in your web-specific config or logs.