PrismarineJS / PrismarineJS/node-minecraft-protocol

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

Open
#1,425 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

possible bug
Dominant language
JavaScript
Stars
1.4k
Forks
290
Avg merge
4d 8h
Merged PRs (30d)
7

Description

[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+).

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the createServer setup and login handler shown in the issue, reproducing client.end("Test") against the listed Minecraft versions. Compare the disconnect behavior and packet decoding across versions; done means players disconnect with the Test message without profile-key, namespace, or cookie-request errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.