#error code 1005

1 messages · Page 1 of 1 (latest)

shrewd laurel
#

Hello @everyone / Deepgram team,

I'm integrating Twilio with Deepgram Voice Agent (Node.js/TS, Piehost) and hitting an issue: Deepgram Agent API closes immediately after receiving Settings with Code: 1005.

Setup: Twilio <-> My Server (proxy) <-> Deepgram Agent (wss://agent.deepgram.com/v1/agent/converse)

Confirmed & Tried:

  • My server's Twilio WebSocket endpoint works (Twilio connects fine).
  • Deepgram API key is valid: Works for curl to api.deepgram.com/v1/listen.
  • API Key Role: Using an 'Admin' role API key (see attached screenshot for options, selected highest permission).
  • Deepgram connection on('open') fires, and Settings message is sent.

Settings Object (audio for Twilio):

{
  "type": "Settings",
  "audio": { "input": { "encoding": "mulaw", "sample_rate": 8000 }, "output": { "encoding": "mulaw", "sample_rate": 8000, "container": "none" } },
  "agent": {
    "speak": { "provider": { "type": "deepgram", "model": "aura-2-odysseus-en" } },
    "think": { "provider": { "type": "open_ai", "model": "gpt-4o-mini" }, "prompt": "You are a helpful voice assistant..." },
    "greeting": "Hello, how can I help you?"
  }
}
Logs (after sending settings):

[56veir] ✅ Deepgram connected
[56veir] 📤 Sent Deepgram config
[56veir] ❌ Deepgram WebSocket closed. Code: 1005, Reason: 
[56veir] ‼️ Deepgram connection closed with an error code: 1005. Check Deepgram docs for this code.
[56veir] 🔌 Twilio WebSocket closed. Code: 1011, Reason:
sweet locustBOT
#

Hey there! This channel allows you to ask Kapa.ai for assistance. But it looks like you haven't connected your Discord profile to your Deepgram account yet. You can do so at https://community.deepgram.com - by doing so, you'll be able to ask questions in #1115960287183511643 if you need human assistance!

north vortexBOT
#

Hi @shrewd laurel. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

The knowledge sources provided do not contain any explicit documentation or discussion about Deepgram returning a WebSocket close code 1005. The official Deepgram documentation for both STT and TTS APIs lists common WebSocket close codes (such as 1000, 1003, 1008, 1009, 1011), but 1005 is not described or mentioned as a possible error code or its meaning in any of the troubleshooting guides or API references[STT WebSocket Errors][TTS WebSocket Errors].

What you can do:

  • Double-check your Settings payload for typos or missing required fields. The structure you posted looks correct for Twilio (mulaw, 8000 Hz, etc.), but ensure all required agent fields are present and valid[Voice Agent Settings].
  • Make sure you are sending the Settings message immediately after the WebSocket connection is established, before sending any audio data[Voice Agent Settings].
  • Confirm your API key is being sent in the correct format in the Authorization header (either token <DEEPGRAM_API_KEY> or Bearer <JWT_TOKEN>)[Voice Agent API Reference].
  • If you have access to the HTTP response headers from the failed WebSocket upgrade, check for a dg-error header, which may contain a more descriptive error message[TTS Troubleshooting].
#

About code 1005:
According to the WebSocket RFC, code 1005 is a reserved value and is not sent over the wire; it is used internally to indicate "no status code present." If you are seeing 1005, it may mean the server closed the connection without providing a specific reason, possibly due to a protocol or payload issue[WebSocket RFC 6455].

Next steps:

  • Try simplifying your Settings payload to the minimal required fields and see if the connection stays open.
  • If the issue persists, contact Deepgram Support with your request_id (if available) and a sample of your Settings payload, as this may indicate an undocumented or internal error.

I'm sorry I can't provide a more specific answer—code 1005 is not documented in the Deepgram knowledge sources, so reaching out to Deepgram Support is likely your best next step.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: