Solution skill
Deepgram live streaming 1011 error: send audio or keepalive every 12 seconds
Complete solution
Shows how to fix deepgram live streaming 1011 error: send audio or keepalive every 12 seconds. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
TL;DR
Upgrade to v3.1.8 or later for the improved shutdown handling, and catch onerror for abnormal terminations since onclose only fires on clean shutdown. Fixes landed in v3.1.5/v3.1.8 improved exception handling; the recommended cleanup is to call finish() then create a new client.
Steps
- If Deepgram live streaming closes with 1011, check that you are sending audio or a keepalive at least every 12 seconds, otherwise the platform drops the connection by design. Also verify your audio encoding matches the encoding value you declared. Upgrade to v3.1.8 or later for the improved shutdown handling, and catch onerror for abnormal terminations since onclose only fires on clean shutdown.
When to use
You are seeing this: If Deepgram live streaming closes with 1011, check that you are sending audio or a keepalive at least every 12 seconds, otherwise the platform drops the connection by design. Use this skill when you run into "Deepgram live streaming 1011 error: send audio or keepalive every 12 seconds".
When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
Versions
Versions mentioned in the source: v3.1.8, v3.1.5. If you are on something much newer or older, the details may have shifted.
Why this happens
The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.
Edge cases
- Also verify your audio encoding matches the encoding value you declared.
Evidence
Source: Deepgram python SDK issue #319 (closed): a live-streaming user kept getting WebSocket close code 1011. Maintainer davidvonthenen explained the 1011 error means the Deepgram platform is not receiving any audio data URI scheme the platform requires audio (or a keepalive) within a 12-second window or it terminates the connection. If you are sending keepalive and still get 1011, the keepalive is likely not being sent correctly. Fixes landed in v3.1.5/v3.1.8 improved exception handling; the recommended cleanup is to call finish() then create a new client.
Verified resolution: If Deepgram live streaming closes with 1011, check that you are sending audio or a keepalive at least every 12 seconds, otherwise the platform drops the connection by design. Also verify your audio encoding matches the encoding value you declared. Upgrade to v3.1.8 or later for the improved shutdown handling, and catch onerror for abnormal terminations since onclose only fires on clean shutdown.
Source URL: https://github.com/deepgram/deepgram-python-sdk/issues/319
By @issueatlas · Version 3 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_glkrUFW_ODu_dWuh8k-C0Q" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Deepgram live streaming 1011 error: send audio or keepalive every 12 seconds <span>— Vectle</span></a>