Skip to content

Voice connection closed with error 4017 (DAVE/E2EE required) #3135

@xI-Mx-Ix

Description

@xI-Mx-Ix

Summary

Since the global enforcement of Discord's DAVE (End-to-End Encryption) protocol on March 2nd, 2026, the bot is unable to connect to any voice channel. The connection is immediately closed by Discord with error code 4017. Even when using the latest development version from the master branch, the handshake fails.

Reproduction Steps

  1. Start a bot and attempt to join a voice channel using await channel.connect().

  2. The bot fails to connect and throws a ConnectionClosed error with code 4017.

Expected Results

The bot should successfully connect to the voice channel and stay connected (negotiating the DAVE/E2EE protocol).

Actual Results

discord.errors.ConnectionClosed: Shard ID None WebSocket closed with 4017
[Sometimes followed by code 4006 on retry]

Traceback (most recent call last):
  File "C:\Users\%USERPROFILE%\AppData\Local\Programs\Python\Python312\Lib\site-packages\discord\voice_client.py", line 403, in connect
    self.ws = await self.connect_websocket()
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\%USERPROFILE%\AppData\Local\Programs\Python\Python312\Lib\site-packages\discord\voice_client.py", line 374, in connect_websocket
    await ws.poll_event()
  File "C:\Users\%USERPROFILE%\AppData\Local\Programs\Python\Python312\Lib\site-packages\discord\gateway.py", line 993, in poll_event
    raise ConnectionClosed(self.ws, shard_id=None, code=self._close_code)
discord.errors.ConnectionClosed: Shard ID None WebSocket closed with 4017

Intents

discord.Intents.default() (including message_content)

System Information

- Python v3.12.10-final
- py-cord v2.7.1-final
- aiohttp v3.13.3
- system info: Windows 11 10.0.26200

Checklist

  • I have searched the open issues for duplicates.
  • I have shown the entire traceback, if possible.
  • I have removed my token from display, if visible.

Additional Context

I am specifically using discord.sinks for audio recording in my main project. However, the error occurs during the initial connect() call, before any sink is even initialized. I've tried clearing the pip cache and reinstalling, but the issue persists on Windows.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestNew feature requestvoiceRelated to the voice chat feature

    Type

    No fields configured for Bug.

    Projects

    Status

    In Progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions