From d46f4786900acf9a6aa9ab11c0cdc48e759d9145 Mon Sep 17 00:00:00 2001 From: DallasCarraher Date: Mon, 14 Sep 2026 01:28:24 -0700 Subject: [PATCH] server: include sessionId in the login success packet for 26.2+ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 26.2 (protocol 776) added a mandatory sessionId: UUID field to packet_success. Since the server-side login flow built the packet without it, the compiled protodef writer threw "Write error for undefined : Cannot read properties of undefined (reading 'length')" as soon as a 26.2 client logged in against a server built on this library — every consumer that hosts its own server (flying-squid, mineflayer's test harness, etc.), not clients connecting to a real Mojang server (which always supplies it). Included unconditionally rather than gated behind a supportFeature check: protodef only reads the fields a version's schema defines, so this is inert on older versions' packet_success where the field doesn't exist. Found and fixed while getting PrismarineJS/minecraft-data#1298 (26.2 data) working end-to-end. Full suite: 6787 passing, 73 pending, 2 failing — both pre-existing and unrelated (a 1.16.5 server-download timeout, and a 26.1 packet-fuzzer gap for the ItemStackTemplate type that predates this change). Zero failures attributable to 26.2. Co-Authored-By: Claude Sonnet 5 --- src/server/login.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/server/login.js b/src/server/login.js index ec40ed913..a4a697ed2 100644 --- a/src/server/login.js +++ b/src/server/login.js @@ -184,7 +184,8 @@ module.exports = function (client, server, options) { client.write('success', { uuid: client.uuid, username: client.username, - properties: [] + properties: [], + sessionId: crypto.randomUUID() // added to packet_success in 26.2 (protocol 776); ignored by protodef on older versions' schemas }) if (client.supportFeature('hasConfigurationState')) { client.once('login_acknowledged', onClientLoginAck)