m
hi
t
Thanks for reaching out, Rahib. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I'd love to help you out! Could you please share a bit more about your question or the issue you're experiencing? That way, I can assist you better.
m
2025-10-09 124839,943 - WARNING livekit.plugins.elevenlabs - websocket closed unexpectedly {"room_name": "room-9JrE-y1WI", "pid": 76965, "job_id": "AJ_SCmFrpRCe2wG"} 2025-10-09 124839,955 - WARNING livekit.agents - failed to synthesize speech, retrying in 0.1s Traceback (most recent call last): File "/Users/reverse/PycharmProjects/cmetric/cmetric-voicekit/.venv/lib/python3.13/site-packages/livekit/agents/tts/tts.py", line 383, in _main_task await self._run(output_emitter) File "/Users/reverse/PycharmProjects/cmetric/cmetric-voicekit/.venv/lib/python3.13/site-packages/livekit/plugins/elevenlabs/tts.py", line 437, in _run raise e File "/Users/reverse/PycharmProjects/cmetric/cmetric-voicekit/.venv/lib/python3.13/site-packages/livekit/plugins/elevenlabs/tts.py", line 432, in _run await waiter livekit.agents._exceptions.APIStatusError: connection closed (status_code=-1, request_id=None, body=None, retryable=True) {"room_name": "room-9JrE-y1WI", "tts": "livekit.plugins.elevenlabs.tts.TTS", "attempt": 1, "streamed": true, "pid": 76965, "job_id": "AJ_SCmFrpRCe2wG"} 2025-10-09 124840,993 - WARNING livekit.plugins.elevenlabs - websocket closed unexpectedly {"room_name": "room-9JrE-y1WI", "pid": 76965, "job_id": "AJ_SCmFrpRCe2wG"} 2025-10-09 124840,998 - WARNING livekit.agents - failed to synthesize speech, retrying in 2.0s Traceback (most recent call last): File "/Users/reverse/PycharmProjects/cmetric/cmetric-voicekit/.venv/lib/python3.13/site-packages/livekit/agents/tts/tts.py", line 383, in _main_task await self._run(output_emitter) File "/Users/reverse/PycharmProjects/cmetric/cmetric-voicekit/.venv/lib/python3.13/site-packages/livekit/plugins/elevenlabs/tts.py", line 437, in _run raise e File "/Users/reverse/PycharmProjects/cmetric/cmetric-voicekit/.venv/lib/python3.13/site-packages/livekit/plugins/elevenlabs/tts.py", line 432, in _run await waiter livekit.agents._exceptions.APIStatusError: connection closed (status_code=-1, request_id=None, body=None, retryable=True) {"room_name": "room-9JrE-y1WI", "tts": "livekit.plugins.elevenlabs.tts.TTS", "attempt": 2, "streamed": true, "pid": 76965, "job_id": "AJ_SCmFrpRCe2wG"}
t
It looks like the error logs are showing some challenges with the ElevenLabs TTS plugin, specifically messages like "websocket closed unexpectedly" and
APIStatusError
. These can happen for a few reasons, and I’m here to help you work through them: • Inactivity Timeout: Sometimes, if the WebSocket connection isn’t active for a while, it might close. To help with this, try sending text consistently or consider tweaking the
inactivity_timeout
setting when you initialize TTS. • Improper XML/SSML Content: If you’re using SSML parsing, double-check that your input text is well-formed and doesn’t have any incomplete XML tags. • Authentication Issues: Make sure your
ELEVEN_API_KEY
is correct and properly set up. • Network or Server-Side Issues: Sometimes, network hiccups or server timeouts can cause these unexpected closures. Adding retry logic in your application can help handle these situations smoothly. Here’s a simple plan to get things back on track: 1. Verify your
ELEVEN_API_KEY
to ensure it’s valid. 2. Check your input text formatting if you’re using SSML. 3. Adjust the
inactivity_timeout
parameter if necessary. 4. Consider implementing retry logic to manage temporary errors. If you'd like to dive deeper, the ElevenLabs TTS plugin documentation is a great resource. And of course, I’m here if you need any more help or have questions—just let me know! Sources: agents/src/inference/tts.ts | ElevenLabs TTS plugin guide | LiveKit Docs | livekit-plugins/livekit-plugins-inworld/livekit/plugins/inworld/tts.py