mineflayer
mineflayer copied to clipboard
TypeError [ERR_INVALID_ARG_TYPE]: Serialization error for play.toServer : SizeOf error for undefined : The "string" argument must be of type string or an instance of Buffer or ArrayBuffer. Received undefined
- [ ] The FAQ doesn't contain a resolution to my issue
Versions
- mineflayer: 2.41.0
- server: vanilla/spigot/paper 1.18.1
- node: 17.8.0
Detailed description of a problem
TypeError [ERR_INVALID_ARG_TYPE]: Serialization error for play.toServer : SizeOf error for undefined : The "string" argument must be of type string or an instance of Buffer or ArrayBuffer. Received undefined
at new NodeError (node:internal/errors:372:5)
at Function.byteLength (node:buffer:735:11)
at Object.string (eval at compile (C:\Users\Test.DESKTOP-418PPE3\Downloads\Afk-Bot1\node_modules\protodef\src\compiler.js:259:12),
What did you try yet?
I have reinstalled protodef, I have reinstalled all modules
Your current code
const mineflayer = require('mineflayer')
const bot = mineflayer.createBot({
host: 'localhost', // minecraft server ip
username: '####@####.####', // minecraft username
password: '####' // minecraft password, comment out if you want to log into online-mode=false servers
port: 42002, // only set if you need a port that isn't 25565
// version: false, // only set if you need a specific version or snapshot (ie: "1.8.9" or "1.16.5"), otherwise it's set automatically
auth: 'microsoft' // only set if you need microsoft auth, then set this to 'microsoft'
})
bot.on('chat', (username, message) => {
if (username === bot.username) return
bot.chat(message)
})
// Log errors and kick reasons:
bot.on('kicked', console.log)
bot.on('error', console.log)
Expected behavior
The bot joined the server
print message before sending it, it seems like it's not right
Der Fehler ist bis jetzt nicht mehr gekommen