-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
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 fpossible bug
Description
- The FAQ doesn't contain a resolution to my issue
Versions
- mineflayer: 4.30.0
- server: vanilla 1.21
- node: 22.17.1
Detailed description of a problem
The bot crashes after a chat is sent. Upon restarting the server completely (localhost lan), the bot will not crash upon first message, however any following messages will crash the bot
What did you try yet?
I have tried a blank bot and I have tried the gps example as seen below. Both will crash
Your current code
// This is an example that uses mineflayer-pathfinder to showcase how simple it is to walk to goals
const mineflayer = require('mineflayer')
const { pathfinder, Movements, goals: { GoalNear } } = require('mineflayer-pathfinder')
if (process.argv.length < 4 || process.argv.length > 6) {
console.log('Usage : node gps.js <host> <port> [<name>] [<password>]')
process.exit(1)
}
const bot = mineflayer.createBot({
host: process.argv[2],
port: parseInt(process.argv[3]),
username: process.argv[4] ? process.argv[4] : 'gps',
password: process.argv[5]
})
const RANGE_GOAL = 1 // get within this radius of the player
bot.loadPlugin(pathfinder)
bot.once('spawn', () => {
const defaultMove = new Movements(bot)
bot.on('chat', (username, message) => {
if (username === bot.username) return
if (message !== 'come') return
const target = bot.players[username]?.entity
if (!target) {
bot.chat("I don't see you !")
return
}
const { x: playerX, y: playerY, z: playerZ } = target.position
bot.pathfinder.setMovements(defaultMove)
bot.pathfinder.setGoal(new GoalNear(playerX, playerY, playerZ, RANGE_GOAL))
})
})
Expected behavior
No crash
Additional context
Node js error below
node:internal/errors:540
throw error;
^
TypeError [ERR_INVALID_ARG_TYPE]: The "list" argument must be an instance of Array. Received an instance of Buffer
at Function.concat (node:buffer:579:3)
at updateAndValidateSession (node_modules\minecraft-protocol\src\client\chat.js:61:114)
at Client.<anonymous> (node_modules\minecraft-protocol\src\client\chat.js:192:55)
at Client.emit (node:events:518:28)
at emitPacket (node_modules\minecraft-protocol\src\client.js:84:12)
at FullPacketParser.<anonymous> (node_modules\minecraft-protocol\src\client.js:113:9)
at FullPacketParser.emit (node:events:518:28)
at addChunk (node_modules\readable-stream\lib\internal\streams\readable.js:323:12)
at readableAddChunk (node_modules\readable-stream\lib\internal\streams\readable.js:300:9)
at Readable.push (node_modules\readable-stream\lib\internal\streams\readable.js:246:10) {
code: 'ERR_INVALID_ARG_TYPE'
}
Node.js v22.17.1
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 fpossible bug