1.20.5 protocol errors / PartialReadError
[ ] The FAQ doesn't contain a resolution to my issue
Versions
- minecraft-protocol: 1.50.0
- server: paper 1.21.1
- node: 20.11.0
Detailed description of a problem
After running the code, it displays in the chat. He logs into the server for a split second and then gets kicked. I tried testing on localhost, everything worked, but after connecting to the server I needed, I got an error.
connected
PartialReadError: Read error for undefined : varint is too big: 70
at new ExtendableError (C:\Users\petru\WebstormProjects\yagodki-logistic-bot\node_modules\protodef\src\utils.js:63:13)
at new PartialReadError (C:\Users\petru\WebstormProjects\yagodki-logistic-bot\node_modules\protodef\src\utils.js:70:5)
at Object.readVarInt [as varint] (C:\Users\petru\WebstormProjects\yagodki-logistic-bot\node_modules\protodef\src\datatypes\utils.js:78:27)
at eval (eval at compile (C:\Users\petru\WebstormProjects\yagodki-logistic-bot\node_modules\protodef\src\compiler.js:262:12), <anonymous>:855:40)
at eval (eval at compile (C:\Users\petru\WebstormProjects\yagodki-logistic-bot\node_modules\protodef\src\compiler.js:262:12), <anonymous>:860:13)
at Object.BlockSet (eval at compile (C:\Users\petru\WebstormProjects\yagodki-logistic-bot\node_modules\protodef\src\compiler.js:262:12), <anonymous>:862:9)
at eval (eval at compile (C:\Users\petru\WebstormProjects\yagodki-logistic-bot\node_modules\protodef\src\compiler.js:262:12), <anonymous>:904:40)
at eval (eval at compile (C:\Users\petru\WebstormProjects\yagodki-logistic-bot\node_modules\protodef\src\compiler.js:262:12), <anonymous>:909:11)
at Object.BlockPredicate (eval at compile (C:\Users\petru\WebstormProjects\yagodki-logistic-bot\node_modules\protodef\src\compiler.js:262:12), <anonymous>:913:9)
at eval (eval at compile (C:\Users\petru\WebstormProjects\yagodki-logistic-bot\node_modules\protodef\src\compiler.js:262:12), <anonymous>:183:50)
Chunk size is 137 but only 12 was read ; partial packet : {"name":"cookie_request","params":{"cookie":"\b\u0000\u0004text\u0000\u0006\n"}}; buffer :000a0800047465787400060ae292b90a0a000a08000474657874006c0a20c2a766d09fd0b8d0bdd0b33a20c2a7363020c2a766d0a2d09fd0a13a20c2a7362a32302e30200ac2a766d09ed0bdd0bbd0b0d0b9d0bd3a20c2a73633330a20c2a766d09dd0b0d0b8d0b3d180d0b0d0bdd0be20c2a73630c2a766d0b42e20c2a73635c2a766d1872e200a00
Chunk size is 136 but only 12 was read ; partial packet : {"name":"cookie_request","params":{"cookie":"\b\u0000\u0004text\u0000\u0006\n"}}; buffer :000a0800047465787400060ae292b90a0a000a08000474657874006b0a20c2a766d09fd0b8d0bdd0b33a20c2a7363020c2a766d0a2d09fd0a13a20c2a7362a32302e30200ac2a766d09ed0bdd0bbd0b0d0b9d0bd3a20c2a736330a20c2a766d09dd0b0d0b8d0b3d180d0b0d0bdd0be20c2a73630c2a766d0b42e20c2a73635c2a766d1872e200a00
Current code
const mc = require('minecraft-protocol')
const client = mc.createClient({
version: '1.21.1',
host: "45.11.16.75",
port: 25029,
username: "username",
})
client.on('connect', function () {
console.info('connected')
})
client.on('disconnect', function (packet) {
console.log('disconnected: ' + packet.reason)
})
but sometimes it displays this, but the nicknames listed here are incorrect Example: LeanBlock transformed to 5LeanBlockA in error
"C:\Program Files\nodejs\node.exe" C:\Users\petru\WebstormProjects\yagodki-logistic-bot\main.js
connected
PartialReadError: Read error for undefined : varint is too big: 70
at new ExtendableError (C:\Users\petru\WebstormProjects\yagodki-logistic-bot\node_modules\protodef\src\utils.js:63:13)
at new PartialReadError (C:\Users\petru\WebstormProjects\yagodki-logistic-bot\node_modules\protodef\src\utils.js:70:5)
at Object.readVarInt [as varint] (C:\Users\petru\WebstormProjects\yagodki-logistic-bot\node_modules\protodef\src\datatypes\utils.js:78:27)
at eval (eval at compile (C:\Users\petru\WebstormProjects\yagodki-logistic-bot\node_modules\protodef\src\compiler.js:262:12), <anonymous>:855:40)
at eval (eval at compile (C:\Users\petru\WebstormProjects\yagodki-logistic-bot\node_modules\protodef\src\compiler.js:262:12), <anonymous>:860:13)
at Object.BlockSet (eval at compile (C:\Users\petru\WebstormProjects\yagodki-logistic-bot\node_modules\protodef\src\compiler.js:262:12), <anonymous>:862:9)
at eval (eval at compile (C:\Users\petru\WebstormProjects\yagodki-logistic-bot\node_modules\protodef\src\compiler.js:262:12), <anonymous>:904:40)
at eval (eval at compile (C:\Users\petru\WebstormProjects\yagodki-logistic-bot\node_modules\protodef\src\compiler.js:262:12), <anonymous>:909:11)
at Object.BlockPredicate (eval at compile (C:\Users\petru\WebstormProjects\yagodki-logistic-bot\node_modules\protodef\src\compiler.js:262:12), <anonymous>:913:9)
at eval (eval at compile (C:\Users\petru\WebstormProjects\yagodki-logistic-bot\node_modules\protodef\src\compiler.js:262:12), <anonymous>:183:50)
Chunk size is 138 but only 12 was read ; partial packet : {"name":"cookie_request","params":{"cookie":"\b\u0000\u0004text\u0000\u0006\n"}}; buffer :000a0800047465787400060ae292b90a0a000a08000474657874006d0a20c2a766d09fd0b8d0bdd0b33a20c2a73631303020c2a766d0a2d09fd0a13a20c2a73632302e30200ac2a766d09ed0bdd0bbd0b0d0b9d0bd3a20c2a73633310a20c2a766d09dd0b0d0b8d0b3d180d0b0d0bdd0be20c2a73630c2a766d0b42e20c2a73635c2a766d1872e200a00
Chunk size is 20 but only 18 was read ; partial packet : {"name":"cookie_request","params":{"cookie":"\u0001�l�%P�9V�����\u001c"}}; buffer :001001c36cb72550da395695e694fb86981cd52f
Chunk size is 136 but only 12 was read ; partial packet : {"name":"cookie_request","params":{"cookie":"\b\u0000\u0004text\u0000\u0006\n"}}; buffer :000a0800047465787400060ae292b90a0a000a08000474657874006b0a20c2a766d09fd0b8d0bdd0b33a20c2a7363020c2a766d0a2d09fd0a13a20c2a73632302e30200ac2a766d09ed0bdd0bbd0b0d0b9d0bd3a20c2a73633320a20c2a766d09dd0b0d0b8d0b3d180d0b0d0bdd0be20c2a73630c2a766d0b42e20c2a73635c2a766d1872e200a00
Chunk size is 69 but only 8 was read ; partial packet : {"name":"cookie_request","params":{"cookie":"HgugaA"}}; buffer :0006486775676141000a0800047465787400064867756761410000056e6576657206616c776179730f0a080004746578740000000a08000474657874000000010467756761
Chunk size is 81 but only 12 was read ; partial packet : {"name":"cookie_request","params":{"cookie":"8Kriper34A"}}; buffer :000a384b7269706572333441000a08000474657874000a384b72697065723334410000056e6576657206616c776179730f0a080004746578740000000a0800047465787400000001084b72697065723334
Chunk size is 75 but only 10 was read ; partial packet : {"name":"cookie_request","params":{"cookie":"6mirm__A"}}; buffer :0008366d69726d5f5f41000a080004746578740008366d69726d5f5f410000056e6576657206616c776179730f0a080004746578740000000a0800047465787400000001066d69726d5f5f
Chunk size is 81 but only 12 was read ; partial packet : {"name":"cookie_request","params":{"cookie":"HwhopluggA"}}; buffer :000a4877686f706c75676741000a08000474657874000a4877686f706c756767410000056e6576657206616c776179730f0a080004746578740000000a08000474657874000000010877686f706c756767
Chunk size is 84 but only 13 was read ; partial packet : {"name":"cookie_request","params":{"cookie":"5LeanBlockA"}}; buffer :000b354c65616e426c6f636b41000a08000474657874000b354c65616e426c6f636b410000056e6576657206616c776179730f0a080004746578740000000a0800047465787400000001094c65616e426c6f636b
Chunk size is 90 but only 15 was read ; partial packet : {"name":"cookie_request","params":{"cookie":"HSwaggyMommyA"}}; buffer :000d485377616767794d6f6d6d7941000a08000474657874000d485377616767794d6f6d6d79410000056e6576657206616c776179730f0a080004746578740000000a08000474657874000000010b5377616767794d6f6d6d79
Chunk size is 99 but only 18 was read ; partial packet : {"name":"cookie_request","params":{"cookie":"8DreamcoreTvManA"}}; buffer :001038447265616d636f726554764d616e41000a08000474657874001038447265616d636f726554764d616e410000056e6576657206616c776179730f0a080004746578740000000a08000474657874000000010e447265616d636f726554764d616e
Confirmed bug on 1.20.5+ due to incorrect holderset data type implementation. Will be fixed with #1347.
Confirmed bug on 1.20.5+ due to incorrect holderset data type implementation. Will be fixed with #1347.
when is the release?
Depends on when someone finishes the remaining work in the PR
BlockSet was removed/fixed in 1.21 with new holderSet/holder implementations in node-minecraft-protocol, but 1.20.5 was not updated, https://github.com/PrismarineJS/minecraft-data/pull/948 will fix
bump
bump
if you have this error, can you please provide a packet buffer
const fs = require('fs')
const file = fs.createWriteStream('log.txt')
bot._client.on('packet', (data, meta, buffer) => {
const x = JSON.stringify([meta, data, buffer.toString('hex')])
file.write(x + '\n')
})
with log.txt
https://raw.githubusercontent.com/MinerSimonDev/apate/refs/heads/master/log.txt
Temporary fix
In my case, the "partial read error" occurs because the server uses Paper and sends custom packets. This issue is present in Mineflayer version 1.21+ but does not occur in version 1.20.4.
To work around this, I used "ViaProxy," set the server version to 1.21, and kept Mineflayer at version 1.20.4. Then, I connected through the proxy.
This resolved the issue, and the error no longer occurs. Use this workaround until the bug is officially fixed.
It's not custom packets but not implementing all the new Item component types yet.
Contributions welcome in https://github.com/PrismarineJS/minecraft-data/pull/948 - already alot of the work is finished