PrismarineJS / PrismarineJS/node-minecraft-protocol

TypeError: Cannot read properties of null (reading 'supportFeature') when using the API wrong.

Open
#1,394 2 comments 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.57.0
  • server: 25w14craftmine "Open to LAN"
  • node: 22.11.0 (docker image node:22)

Detailed description of a problem

/app/devel.@/node-minecraft-protocol/src/client.js:33
    this._supportFeature = mcData.supportFeature
                                  ^

TypeError: Cannot read properties of null (reading 'supportFeature')
    at new Client (/app/devel.@/node-minecraft-protocol/src/client.js:33:35)
    at file:///app/bot.mjs:13:17
    at ModuleJob.run (node:internal/modules/esm/module_job:268:25)
    at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:543:26)
    at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:116:5)

Node.js v22.11.0

Current code

Edit: Actually this happens with even just

import mcrProto from 'minecraft-protocol';
const McrClient = mcrProto.Client;
(new McrClient()).connect();

Expected behavior

A more helpful error message is printed. Ideally one that says I'm using the API wrong and should read the current version's hello world example.

Additional context

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 in src/client.js at line 33 and reproduce the failure with the minimal McrClient snippet shown in the issue. Compare the call with the current version's hello world example; done means the incorrect API usage produces a helpful error explaining the expected usage instead of the null supportFeature TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.