PrismarineJS / mineflayer

Create Minecraft bots with a powerful, stable, and high level JavaScript API.
https://prismarinejs.github.io/mineflayer/
MIT License
4.96k stars 904 forks source link

ChunkColumn.loadParsedLight throwing error randomly. #2159

Closed stephenkhoo closed 3 years ago

stephenkhoo commented 3 years ago

Versions

Detailed description of a problem

The situation happen randomly, it happen after I update it to 3.11.0 to play with Minecraft 1.17. The server return this error, and causes the bot to disconnect.

TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received undefined
    at Function.from (buffer.js:333:9)
    at ChunkColumn.loadParsedLight (/Users/stephenkhoo/Sites/mcbot/node_modules/prismarine-chunk/src/pc/1.17/ChunkColumn.js:322:38)
    at Client.<anonymous> (/Users/stephenkhoo/Sites/mcbot/node_modules/mineflayer/lib/plugins/blocks.js:311:14)
    at Client.emit (events.js:315:20)
    at FullPacketParser.<anonymous> (/Users/stephenkhoo/Sites/mcbot/node_modules/minecraft-protocol/src/client.js:91:12)
    at FullPacketParser.emit (events.js:315:20)
    at addChunk (/Users/stephenkhoo/Sites/mcbot/node_modules/readable-stream/lib/_stream_readable.js:298:12)
    at readableAddChunk (/Users/stephenkhoo/Sites/mcbot/node_modules/readable-stream/lib/_stream_readable.js:280:11)
    at FullPacketParser.Readable.push (/Users/stephenkhoo/Sites/mcbot/node_modules/readable-stream/lib/_stream_readable.js:241:10)
    at FullPacketParser.Transform.push (/Users/stephenkhoo/Sites/mcbot/node_modules/readable-stream/lib/_stream_transform.js:139:32) {
  code: 'ERR_INVALID_ARG_TYPE'
}

What did you try yet?

I try to let the bot to travel around, but it seems to happen quite randomly. Same action sometimes causes it from happen and sometimes not. Sometimes even staying static will have this error. So I think it maybe have something to do with the background work done by mineflayer.

From the code, it seems like something have to do with the light.

Expected behavior

No this error.

nickelpro commented 3 years ago

Update your dependencies, fixed in pr-chunk 1.26.0