{"message": "livekit.plugins.deepgram.stt.STT reco...
# ask-ai
a
{"message": "livekit.plugins.deepgram.stt.STT recovery unexpected error\nTraceback (most recent call last):\n File \"/home/appuser/.local/lib/python3.11/site-packages/livekit/agents/stt/stt.py\", line 369, in __anext__\n val = await self._event_aiter.__anext__()\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nStopAsyncIteration\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File \"/home/appuser/.local/lib/python3.11/site-packages/livekit/agents/stt/fallback_adapter.py\", line 377, in _recover_stt_task\n async for ev in stream:\n File \"/home/appuser/.local/lib/python3.11/site-packages/livekit/agents/stt/stt.py\", line 372, in __anext__\n raise exc # noqa: B904\n ^^^^^^^^^\n File \"/home/appuser/.local/lib/python3.11/site-packages/livekit/agents/stt/stt.py\", line 253, in _main_task\n return await self._run()\n ^^^^^^^^^^^^^^^^^\n File \"/home/appuser/.local/lib/python3.11/site-packages/livekit/plugins/deepgram/stt.py\", line 509, in _run\n ws = await self._connect_ws()\n ^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/home/appuser/.local/lib/python3.11/site-packages/livekit/plugins/deepgram/stt.py\", line 573, in _connect_ws\n ws = await asyncio.wait_for(\n ^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.11/asyncio/tasks.py\", line 489, in wait_for\n return fut.result()\n ^^^^^^^^^^^^\n File \"/home/appuser/.local/lib/python3.11/site-packages/aiohttp/client.py\", line 1472, in send\n return self._coro.send(arg)\n ^^^^^^^^^^^^^^^^^^^^\n File \"/home/appuser/.local/lib/python3.11/site-packages/aiohttp/client.py\", line 1084, in _ws_connect\n raise WSServerHandshakeError(\naiohttp.client_exceptions.WSServerHandshakeError: 402, message='Invalid response status', url=\"wss://api.deepgram.com/v1/listen?model=nova-3&punctuate=true&smart_format=false&no_delay=true&interim_results=true&encoding=linear16&vad_events=true&sample_rate=16000&channels=1&endpointing=100&filler_words=true&profanity_filter=false&numerals=false&mip_opt_out=true&keyterm=Yes.&keyterm=Okay.&keyterm=Yeah.&keyterm=Hello?&keyterm=Sure.&keyterm=Yep.+&keyterm=No.&keyterm=I'm&keyterm=Done.&keyterm=Ready.&keyterm=It's+&keyterm=Mhmm.&keyterm=+Alright.+&keyterm=Hello.+&keyterm=Oh,&keyterm=+Yes,&keyterm=Right.&keyterm=K.&keyterm=+Nope.&keyterm=What?&keyterm=Goodbye.&keyterm=Hi.&keyterm=Good.&keyterm=Hello,&keyterm=Uh-huh.&keyterm=Continue.&keyterm=Finished.&keyterm=Please.&keyterm=Hey.&keyterm=Saved.+&keyterm=Definitely.&language=en\"", "level": "ERROR", "name": "livekit.agents", "streamed": true, "pid": 55, "job_id": "AJ_te4mApLKMKz7", "timestamp": "2025-10-07T151125.751066+00:00"}
t
Thanks for reaching out, Nagaraj. 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
WSServerHandshakeError 402
in your LiveKit Deepgram STT integration, which usually points to a hiccup during the WebSocket handshake. Although HTTP 402 (Payment Required) isn’t something Deepgram commonly uses, let’s walk through a few steps together to help get this sorted: • First, please double-check that your
DEEPGRAM_API_KEY
is correctly set in your environment or properly passed to the STT constructor. • Next, make sure the model, language, and other configuration settings are valid and compatible with each other. • Also, take a moment to verify your network connection to Deepgram’s WebSocket endpoint at
wss://api.deepgram.com/v1/listen
. • Lastly, it’s a good idea to confirm that your Deepgram account is active and there aren’t any billing issues. If you’re still running into this error after these checks, reaching out to Deepgram support might shed more light on the 402 status. Please don’t hesitate to ask if you’d like me to guide you through any of these steps—I’m here to help! Sources: examples/voice_agents/zapier_mcp_integration.py | Deepgram STT plugin guide | LiveKit Docs | Deepgram STT | LiveKit Docs | Deepgram STT integration guide | LiveKit Docs | plugins/deepgram/src/stt.ts