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

Chunk size issue #1178

Closed CrackThrough closed 4 years ago

CrackThrough commented 4 years ago

[ ] The FAQ doesn't contain a resolution to my issue

Versions

Problem (Error Log)

Happens almost immediately when I start my nodejs process

Chunk size is 255 but only 1 was read ; partial packet : {}; buffer :1afc017b227472616e736c617465223a22646973636f6e6e6563742e67656e65726963526561736f6e222c2277697468223a5b22496e7465726e616c20457863657074696f6e3a20696f2e6e657474792e68616e646c65722e636f6465632e4465636f646572457863657074696f6e3a206a6176612e6c616e672e496e6465784f75744f66426f756e6473457863657074696f6e3a20726561646572496e646578283129202b206c656e677468283129206578636565647320777269746572496e6465782831293a20506f6f6c6564556e736166654469726563744279746542756628726964783a20312c20776964783a20312c206361703a203129225d7d

d:\Workspace\node_modules\mineflayer\node_modules\minecraft-protocol\src\transforms\framing.js:67 } else { throw e } ^

TypeError: Cannot read property 'length' of undefined at FullPacketParser. (d:\Workspace\node_modules\mineflayer\node_modules\minecraft-protocol\src\client.js:86:15) at FullPacketParser.emit (events.js:315:20) at addChunk (d:\Workspace\node_modules\readable-stream\lib_stream_readable.js:297:12) at readableAddChunk (d:\Workspace\node_modules\readable-stream\lib_stream_readable.js:279:11) at FullPacketParser.Readable.push (d:\Workspace\node_modules\readable-stream\lib_stream_readable.js:240:10) at FullPacketParser.Transform.push (d:\Workspace\node_modules\readable-stream\lib_stream_transform.js:139:32) at FullPacketParser._transform (d:\Workspace\node_modules\mineflayer\node_modules\protodef\src\serializer.js:82:10) at FullPacketParser.Transform._read (d:\Workspace\node_modules\readable-stream\lib_stream_transform.js:177:10) at FullPacketParser.Transform._write (d:\Workspace\node_modules\readable-stream\lib_stream_transform.js:164:83) at doWrite (d:\Workspace\node_modules\readable-stream\lib_stream_writable.js:405:139) Process exited with code 1

Serverside information

Bot Location is 356.5 71.0 1155.5 Bot Gamemode is 3 (spectator mode)

Dimension type is minecraft:overworld Map seed is 1783548169946369349 I cannot provide you the entire map, sorry :(

Additional context

Cannot provide code, and not even related to my code. Copy pasted the example code and happened the same.

I have no idea how I should fix this, but I do know that I don't need chunk rendering and parsing, I just want it to read chat and response. It would be grateful if you make another version of API for people like me.

rom1504 commented 4 years ago

The error is not related with chunks in the minecraft sense. It's just a packet chunk. What kind of server is it ?

On Fri, Jul 24, 2020, 11:03 CrackThrough notifications@github.com wrote:

[ ] The FAQ https://github.com/PrismarineJS/mineflayer/blob/master/docs/FAQ.md doesn't contain a resolution to my issue Versions

  • mineflayer: 1.16.1
  • server: spigot 1.16.1
  • node: 14.4.0

Problem (Error Log)

Happens almost immediately when I start my nodejs process

Chunk size is 255 but only 1 was read ; partial packet : {}; buffer :1afc017b227472616e736c617465223a22646973636f6e6e6563742e67656e65726963526561736f6e222c2277697468223a5b22496e7465726e616c20457863657074696f6e3a20696f2e6e657474792e68616e646c65722e636f6465632e4465636f646572457863657074696f6e3a206a6176612e6c616e672e496e6465784f75744f66426f756e6473457863657074696f6e3a20726561646572496e646578283129202b206c656e677468283129206578636565647320777269746572496e6465782831293a20506f6f6c6564556e736166654469726563744279746542756628726964783a20312c20776964783a20312c206361703a203129225d7d

d:\Workspace\node_modules\mineflayer\node_modules\minecraft-protocol\src\transforms\framing.js:67 } else { throw e } ^

TypeError: Cannot read property 'length' of undefined at FullPacketParser. (d:\Workspace\node_modules\mineflayer\node_modules\minecraft-protocol\src\client.js:86:15) at FullPacketParser.emit (events.js:315:20) at addChunk (d:\Workspace\node_modules\readable-stream\lib_stream_readable.js:297:12) at readableAddChunk (d:\Workspace\node_modules\readable-stream\lib_stream_readable.js:279:11) at FullPacketParser.Readable.push (d:\Workspace\node_modules\readable-stream\lib_stream_readable.js:240:10) at FullPacketParser.Transform.push (d:\Workspace\node_modules\readable-stream\lib_stream_transform.js:139:32) at FullPacketParser._transform (d:\Workspace\node_modules\mineflayer\node_modules\protodef\src\serializer.js:82:10) at FullPacketParser.Transform._read (d:\Workspace\node_modules\readable-stream\lib_stream_transform.js:177:10) at FullPacketParser.Transform._write (d:\Workspace\node_modules\readable-stream\lib_stream_transform.js:164:83) at doWrite (d:\Workspace\node_modules\readable-stream\lib_stream_writable.js:405:139) Process exited with code 1 Serverside information

Bot Location is 356.5 71.0 1155.5 Bot Gamemode is 3 (spectator mode)

Dimension type is minecraft:overworld Map seed is 1783548169946369349 I cannot provide you the entire map, sorry :( Additional context

Cannot provide code, and not even related to my code. Copy pasted the example code and happened the same.

I have no idea how I should fix this, but I do know that I don't need chunk rendering and parsing, I just want it to read chat and response. It would be grateful if you make another version of API for people like me.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/PrismarineJS/mineflayer/issues/1178, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAR437SM5F2742FQ7D4MNIDR5FE4RANCNFSM4PGQTMVA .

rom1504 commented 4 years ago

Ah spigot. Any specific plugin ?

On Fri, Jul 24, 2020, 12:24 Romain Beaumont romain.rom1@gmail.com wrote:

The error is not related with chunks in the minecraft sense. It's just a packet chunk. What kind of server is it ?

On Fri, Jul 24, 2020, 11:03 CrackThrough notifications@github.com wrote:

[ ] The FAQ https://github.com/PrismarineJS/mineflayer/blob/master/docs/FAQ.md doesn't contain a resolution to my issue Versions

  • mineflayer: 1.16.1
  • server: spigot 1.16.1
  • node: 14.4.0

Problem (Error Log)

Happens almost immediately when I start my nodejs process

Chunk size is 255 but only 1 was read ; partial packet : {}; buffer :1afc017b227472616e736c617465223a22646973636f6e6e6563742e67656e65726963526561736f6e222c2277697468223a5b22496e7465726e616c20457863657074696f6e3a20696f2e6e657474792e68616e646c65722e636f6465632e4465636f646572457863657074696f6e3a206a6176612e6c616e672e496e6465784f75744f66426f756e6473457863657074696f6e3a20726561646572496e646578283129202b206c656e677468283129206578636565647320777269746572496e6465782831293a20506f6f6c6564556e736166654469726563744279746542756628726964783a20312c20776964783a20312c206361703a203129225d7d

d:\Workspace\node_modules\mineflayer\node_modules\minecraft-protocol\src\transforms\framing.js:67 } else { throw e } ^

TypeError: Cannot read property 'length' of undefined at FullPacketParser. (d:\Workspace\node_modules\mineflayer\node_modules\minecraft-protocol\src\client.js:86:15) at FullPacketParser.emit (events.js:315:20) at addChunk (d:\Workspace\node_modules\readable-stream\lib_stream_readable.js:297:12) at readableAddChunk (d:\Workspace\node_modules\readable-stream\lib_stream_readable.js:279:11) at FullPacketParser.Readable.push (d:\Workspace\node_modules\readable-stream\lib_stream_readable.js:240:10) at FullPacketParser.Transform.push (d:\Workspace\node_modules\readable-stream\lib_stream_transform.js:139:32) at FullPacketParser._transform (d:\Workspace\node_modules\mineflayer\node_modules\protodef\src\serializer.js:82:10) at FullPacketParser.Transform._read (d:\Workspace\node_modules\readable-stream\lib_stream_transform.js:177:10) at FullPacketParser.Transform._write (d:\Workspace\node_modules\readable-stream\lib_stream_transform.js:164:83) at doWrite (d:\Workspace\node_modules\readable-stream\lib_stream_writable.js:405:139) Process exited with code 1 Serverside information

Bot Location is 356.5 71.0 1155.5 Bot Gamemode is 3 (spectator mode)

Dimension type is minecraft:overworld Map seed is 1783548169946369349 I cannot provide you the entire map, sorry :( Additional context

Cannot provide code, and not even related to my code. Copy pasted the example code and happened the same.

I have no idea how I should fix this, but I do know that I don't need chunk rendering and parsing, I just want it to read chat and response. It would be grateful if you make another version of API for people like me.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/PrismarineJS/mineflayer/issues/1178, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAR437SM5F2742FQ7D4MNIDR5FE4RANCNFSM4PGQTMVA .

CrackThrough commented 4 years ago

No plugins installed

Karang commented 4 years ago

Some additional infos: The packet received (1a) is the "kick_disconnect" packet https://github.com/PrismarineJS/minecraft-data/blob/master/data/pc/1.16.1/protocol.json#L1776 The decoded reason string says:

{"translate":"disconnect.genericReason","with":["Internal Exception: io.netty.handler.codec.DecoderException: java.lang.IndexOutOfBoundsException: readerIndex(1) + length(1) exceeds writerIndex(1): PooledUnsafeDirectByteBuf(ridx: 1, widx: 1, cap: 1)"]}

The TypeError: Cannot read property 'length' of undefined error is a consequence of the packet not being decoded properly.

Karang commented 4 years ago

Since the server is kicking you because it fails to decode one of your packet. This could be coming from your code. Have you tried with one of the mineflayer example ?

CrackThrough commented 4 years ago

what, but my app got crashed for same error using one of mineflayer examples?

Copy pasted the example code and happened the same.

alright I will try to update mineflayer and everything related to this and try again soon. I will comment the result after this test.

Karang commented 4 years ago

@CrackThrough did you retry with updated mineflayer ?

CrackThrough commented 4 years ago

I will try to post result within a week. Sorry I don't really have much time often. :(

CrackThrough commented 4 years ago

Tested within same environment with the different map file (server's owner was not me and the server was temporary). Updated version of mineflayer didn't replicate the same error I was getting. My conclusion is something in the new update fixed this error, or it was my simple mistake I was not aware of. If someone else is having a same issue, you could update to new version or double check what you were doing.

Karang commented 4 years ago

Ok, thanks for the info.