{"message": "send loop error\nTraceback (most rece...
# ask-ai
s
{"message": "send loop error\nTraceback (most recent call last):\n File \"/usr/local/lib/python3.12/site-packages/livekit/plugins/elevenlabs/tts.py\", line 572, in _send_loop\n _strip_nones(dataclasses.asdict(self._opts.voice_settings))\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/dataclasses.py\", line 1319, in asdict\n raise TypeError(\"asdict() should be called on dataclass instances\")\nTypeError: asdict() should be called on dataclass instances", "level": "WARNING", "name": "livekit.plugins.elevenlabs", "pid": 105, "job_id": "AJ_DQhD6uoAS9FL", "timestamp": "2025-11-14T132008.315136+00:00"}
t
Thanks for reaching out, Youssef. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
It looks like you're encountering the error "asdict() should be called on dataclass instances" because a non-dataclass object was passed to the ElevenLabs TTS plugin, where a
VoiceSettings
dataclass instance is expected. This usually happens when the
dataclasses.asdict()
function is called on the
voice_settings
parameter. Here’s a friendly guide to help you resolve this: 1. First, please make sure that
voice_settings
is indeed a
VoiceSettings
dataclass instance. For example:
Copy code
from livekit.plugins.elevenlabs import TTS, VoiceSettings

tts = TTS(
    voice_id="your_voice_id",
    voice_settings=VoiceSettings(
        stability=0.75,
        similarity_boost=0.75,
        style=0.5,
        use_speaker_boost=True
    )
)
1. If your data is coming dynamically (like from JSON), you can unpack it into the
VoiceSettings
constructor using the
**
operator, like this:
Copy code
data = {"stability": 0.7, "similarity_boost": 0.8}
voice_settings = VoiceSettings(**data)
tts = TTS(voice_settings=voice_settings)
Just a gentle reminder: avoid passing raw dictionaries directly to the
voice_settings
parameter, as this will cause the error you saw. If you have any questions or need a hand with this, please don’t hesitate to ask—I’m here to help! Sources: livekit-plugins/livekit-plugins-cartesia/livekit/plugins/cartesia/tts.py | ElevenLabs TTS plugin guide | LiveKit Docs