Skip to content

Bot Disconnects on Server Redirection #3640

Open
@GustyCube

Description

@GustyCube

Versions

  • mineflayer: #.#.#
  • server: Paper 1.21.5 (behind BungeeCord proxy)
  • node: v23.11.0

Detailed description of a problem

I’m building a Mineflayer bot that should switch between backend servers via a BungeeCord proxy by issuing a chat-command. When I run /server hub, the bot is correctly sent through the proxy but then immediately disconnects with a timeout (e.g. Error: Timed out). Manually typing the same command as a player works fine—only the bot is getting dropped.

What did you try yet?

  • Verified that the proxy and backend servers work for real players.
  • Tried issuing the switch command both in bot.once('spawn') and bot.once('login').
  • Disabled physics and other plugins (no effect).
  • Attempted using the version and checkTimeoutInterval options when creating the bot.

Your current code

const mineflayer = require('mineflayer');

const bot = mineflayer.createBot({
  host: 'proxy.example.com',
  port: 25565,
  username: 'MyBot',
  version: '1.21.5',
  checkTimeoutInterval: 60 * 1000
});

bot.once('spawn', () => {
  // Send through BungeeCord to the “hub” server
  bot.chat('/server hub');
});

bot.on('end', (reason) => {
  console.log('Disconnected:', reason);
});

bot.on('error', (err) => {
  console.error('Bot error:', err);
});

Expected behavior

After sending /server hub, the bot should reconnect seamlessly to the hub backend and stay online, just like a normal player, instead of immediately timing out.

Additional context

  • BungeeCord is set up with multiple backend instances on different ports.
  • No special firewall or IP-whitelisting rules on the proxy.
  • The disconnect message is always a timeout rather than a KICK packet.
  • Happy to provide logs or a packet capture if it helps!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stage1just created by someone new to the project, we don't know yet if it deserves an implementation / a fpossible bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions