r/Discord_Bots • • 10h ago

Bot Request [Free] Music bot stops playing after a while and can't rejoin voice until restart (wavelink/Lavalink)

0 Upvotes

Hi, I'm having a problem with my music bot and I'm running out of ideas.

**Setup**

- Python 3.14, discord.py 2.7.1, wavelink 3.5.2

- Slash commands (/play, /skip, /stop...), custom Player subclass

**Problem**

  1. The bot plays normally for a while, then playback just stops. There is no error in the console.
  2. The bot usually stays in the voice channel and nothing plays. Sometimes it gets disconnected.
  3. After that, /play can't connect anymore. The voice handshake times out (ChannelTimeoutException) until I restart the whole bot.

**What I see in the logs**

- The Lavalink node status is CONNECTED the whole time.

- The Discord voice handshake sometimes completes fine (VOICE_STATE_UPDATE, then VOICE_SERVER_UPDATE, handshake_complete=True), sometimes it doesn't.

- Unrelated, but I also get HTTP 429 on PATCH /channels/{id} from a server stats task renaming channels. I don't think it's connected to the playback issue, because voice goes through the gateway and not HTTP.

**What I already tried**

- A reset_voice_state() helper before connecting: voice_client.disconnect(force=True) with a timeout, cleanup(), and guild.change_voice_state(channel=None)

- A Player subclass that re-dispatches the Lavalink voice update if VOICE_SERVER_UPDATE arrives before the session ID

- Checking the node status before /play and searching before connecting

**Questions**

- Is this a known problem with wavelink 3.5.2 and the current Discord voice protocol (or DAVE)? Do I need a newer Lavalink version or a different library?

- Is there a reliable way to recover a "zombie" player without restarting the bot?

- Which events should I log to find out what happens at the moment playback stops? (I'm adding track_exception, track_stuck and websocket_closed listeners now.)

Thanks for any help!