Skip to content

Bug Report: Connection Error During Server Transfer #3776

@StarWeizz

Description

@StarWeizz
  • The FAQ doesn't contain a resolution to my issue

📋 Summary

Mineflayer bots get kicked with the error "An internal error occurred during your connection" when transferring between servers via Velocity Proxy on Minecraft 1.21+.


🔍 Problem Description

Observed Behavior

  • ✅ Bot successfully connects to Velocity lobby
  • ✅ Authentication with /login works
  • ✅ Command /joinq <server> is executed
  • Bot is kicked during the destination server's configuration phase

Error Message

An internal error occurred during your connection.

Technical Logs

📦 [CONFIG] Packet received: select_known_packs
   Data: {
     "packs": [
       {
         "namespace": "minecraft",
         "id": "core",
         "version": "1.21.8"
       }
     ]
   }

📦 [CONFIG] Packet received: registry_data
   [... huge amount of data ...]

📦 [CONFIG] Packet received: disconnect
   Data: {
     "reason": "An internal error occurred during your connection."
   }

🛠️ Environment

Component Version
Server Paper 1.21.8
Proxy Velocity
Mineflayer 4.33.0
minecraft-protocol 1.62.0
Node.js v22+
OS Windows

Server Configuration

  • Lobby : Velocity Proxy → ✅ Works
  • Server A : Transfer from lobby → ✅ Works with fix
  • Server B : Transfer from lobby → ❌ Fails even with fix (custom resource pack)

🔬 Technical Analysis

Root Cause

Known Mineflayer bug with Minecraft 1.21+ during Velocity transfers:

Problematic Packets

  1. select_known_packs: Data pack negotiation (new in 1.21)
  2. registry_data: Massive registry data transmission
  3. Physics packets: Sent during configuration instead of waiting for spawn

✅ Partial Solution Applied

Implemented Fix

// In BotFactory.js
const botOptions = {
  username,
  auth: config.bots.auth,
  keepAlive: config.bots.keepAlive,
  hideErrors: false,
  checkTimeoutInterval: 30000,
  closeTimeout: 120000,
  // FIX: Disable physics during configuration
  physicsEnabled: false,  // ← Solution
};

// Re-enable after spawn
bot.once('spawn', async () => {
  setTimeout(() => {
    if (!bot._ended) {
      bot.physicsEnabled = true;  // ← Re-activation
    }
  }, 2000);
  // ...
});

Tested Versions

MC Version Lobby Server A Server B (with resource pack)
1.21.8
1.21.4
1.21.1
1.20.6

📊 Results

✅ What Works

  • Initial connection to Velocity lobby
  • Transfer to servers without custom resource pack (e.g., Server A)
  • Authentication and commands

❌ What Doesn't Work

  • Transfer to servers with large custom resource packs (e.g., Server B)
  • Servers sending large amounts of registry_data during configuration

📝 Bug Reproduction

Minimal Test Code

import mineflayer from 'mineflayer';

const bot = mineflayer.createBot({
  host: 'your.server.ip',
  port: 25565,
  username: 'TestBot',
  auth: 'offline',
  version: '1.21.1',
  physicsEnabled: false,  // FIX
});

bot.on('spawn', () => {
  console.log('✅ Spawn successful');

  // Re-enable physics
  setTimeout(() => {
    bot.physicsEnabled = true;
  }, 2000);

  // Attempt transfer
  setTimeout(() => {
    bot.chat('/login password');

    setTimeout(() => {
      bot.chat('/joinq targetserver');  // ← Fails here
    }, 2000);
  }, 3000);
});

bot.on('kicked', (reason) => {
  console.log('❌ Kicked:', reason);
});

Steps to Reproduce

  1. Connect to Velocity lobby
  2. Execute /login <password>
  3. Execute /joinq <server> (server with resource pack)
  4. Observe kick with "internal error"

🔗 References


Bot Logs During Kick

🔧 select_known_packs packet received!
   Data received: {
  "packs": [
    {
      "namespace": "minecraft",
      "id": "core",
      "version": "1.21.8"
    }
  ]
}
📦 [CONFIG] Packet received: registry_data
   [... 1.6 million characters of data ...]
📦 [CONFIG] Packet received: disconnect
   Data: {
  "reason": {
    "type": "compound",
    "value": {
      "color": {
        "type": "string",
        "value": "red"
      },
      "text": {
        "type": "string",
        "value": "An internal error occurred during your connection."
      }
    }
  }
}
❌ Bot kicked!

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 fbugcontribution-wantednon-vanilla

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions