Skip to content

Disconnecting players during the Login phase results in errors in 1.19+ #1425

Description

@JulianVennen

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

Versions

  • minecraft-protocol: 1.61.0
  • client: vanilla 1.19
  • node: 22.18.0

Detailed description of a problem

A clear and concise description of what the problem is.

Current code

import mc from 'minecraft-protocol';

const server = mc.createServer({
    'online-mode': true,
    encryption: true,
    host: '0.0.0.0',
    port: 25565,
    version: false,
    fallbackVersion: mc.defaultVersion,
    hideErrors: false,
    enforceSecureProfile: true
});

server.on('login', (client) => {
    client.end("Test")
});

Expected behavior

The user should be disconnected with the message Test.

Additional context

The error message varies depending on the Minecraft version used.
1.18.2: works
1.19: Unable to parse profile public key.
1.20/1.20.1: works
1.20.2/3/4: Internal Exception: io.netty.handler.codec.DecoderException: z: Non [a-z0-9_.-] character in namespace of location: {\"text\":\"Test\"}
1.20.5:/1.21/1.21.5: Internal Exception: io.netty.handler.codec.DecoderException: Failed to decode packet 'clientbound/minecraft:cookie_request'

I'm not sure if all of these are caused by the same bug or if there are different issues at play here, but they are all broken in the same use case. To me, it looks like node-mcp is sending the wrong packet ID for the disconnect packet, and it is interpreted as a cookie request packet instead (1.20.5+).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions