-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
Stage1just created by someone new to the project, we don't know yet if it deserves an implementation / a fjust created by someone new to the project, we don't know yet if it deserves an implementation / a fbugcontribution-wantednon-vanilla
Description
- 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
/loginworks - ✅ 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:
- GitHub Issue: Server redirection error #3764
- Problem: Mineflayer sends physics packets during the configuration phase, causing a server-side error
Problematic Packets
select_known_packs: Data pack negotiation (new in 1.21)registry_data: Massive registry data transmission- 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_dataduring 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
- Connect to Velocity lobby
- Execute
/login <password> - Execute
/joinq <server>(server with resource pack) - Observe kick with "internal error"
🔗 References
- Main GitHub Issue: Server redirection error #3764
- Associated PR: Disable physics during configuration packet #3722
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!
LJ5O and xpecel
Metadata
Metadata
Assignees
Labels
Stage1just created by someone new to the project, we don't know yet if it deserves an implementation / a fjust created by someone new to the project, we don't know yet if it deserves an implementation / a fbugcontribution-wantednon-vanilla