{"level": "WARNING", "name": "livekit.agents", "me...
# ask-ai
s
{"level": "WARNING", "name": "livekit.agents", "message": "failed to recognize speech, retrying in 0.1s\nTraceback (most recent call last):\n File \"/usr/local/lib/python3.10/site-packages/livekit/plugins/deepgram/stt.py\", line 209, in _recognize_impl\n async with self._ensure_session().post(\n File \"/usr/local/lib/python3.10/site-packages/aiohttp/client.py\", line 1510, in __aenter__\n self._resp: _RetType = await self._coro\n File \"/usr/local/lib/python3.10/site-packages/aiohttp/client.py\", line 779, in _request\n resp = await handler(req)\n File \"/usr/local/lib/python3.10/site-packages/aiohttp/client.py\", line 757, in _connect_and_send_request\n await resp.start(conn)\n File \"/usr/local/lib/python3.10/site-packages/aiohttp/client_reqrep.py\", line 539, in start\n message, payload = await protocol.read() # type: ignore[union-attr]\n File \"/usr/local/lib/python3.10/site-packages/aiohttp/streams.py\", line 680, in read\n await self._waiter\naiohttp.client_exceptions.ServerDisconnectedError: Server disconnected\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/usr/local/lib/python3.10/site-packages/livekit/agents/stt/stt.py\", line 151, in recognize\n event = await self._recognize_impl(\n File \"/usr/local/lib/python3.10/site-packages/livekit/plugins/deepgram/stt.py\", line 237, in _recognize_impl\n raise APIConnectionError() from e\nlivekit.agents._exceptions.APIConnectionError: Connection error. (body=None, retryable=True)", "tts": "livekit.plugins.deepgram.stt.STT", "attempt": 1, "streamed": false, "pid": 3238, "job_id": "AJ_ECZiNPfKjcmv", "room_id": "RM_HSg87oGCbFGG", "timestamp": "2025-12-07T195918.168959+00:00"} what may be the reason ? seems like ECS created new task after this
t
Thanks for reaching out, Alex. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
You're seeing a transient connection drop between the LiveKit STT agent and Deepgram's API. That log shows a ServerDisconnectedError thrown, converted to an APIConnectionError and marked retryable — the agent retried the request (0.1s) rather than immediately crashing. Likely causes • Transient network blip between your ECS task and Deepgram (packet loss, routing hiccup, DNS). • Deepgram closing the connection (rate limiting, backend momentary drop, or idle timeout). • An intermediary (load balancer, firewall, NAT gateway) dropped the streaming connection. Does this imply ECS created a new task? • Not necessarily. A single retryable connection error alone does not force ECS to replace a task. ECS would create a new task only if the agent process crashed, failed health checks, or an orchestration policy triggered a restart. The log you shared shows a retry attempt, which is normal behavior and does not by itself indicate task restart. Recommended next steps • Check for repeated occurrences in logs (frequency, pattern). If it’s rare, it’s likely transient. • Inspect ECS task health/exit/agent crash logs and ECS event history around the timestamp to see if a new task was started and why. • From an affected ECS instance, run network checks to Deepgram endpoints (curl, traceroute, DNS resolution) at similar times to reproduce. • Review Deepgram usage/limits and any status/incidents for the same timeframe. • If you want resilience, consider configuring a fallback STT provider or adjust retry/timeout settings. If you can share whether you see matching ECS task stop/start events or more repeated errors, I can help interpret those logs and suggest precise configuration or mitigation. Sources: Events and error handling | LiveKit docs