PrismarineJS / mineflayer

Create Minecraft bots with a powerful, stable, and high level JavaScript API.
https://prismarinejs.github.io/mineflayer/
MIT License
4.96k stars 904 forks source link

TypeError: Cannot read property 'entity' of null #1193

Closed overtimepog closed 4 years ago

overtimepog commented 4 years ago

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

/Users/overtime/Desktop/WalterBotMC2.0/node_modules/minecraft-protocol/src/transforms/framing.js:67 } else { throw e } ^

TypeError: Cannot read property 'entity' of null

Versions

Detailed description of a problem

A clear and concise description of what the problem is.

I am trying to make a Minecraft bot for an anarchy server but every time I boot it up after anywhere from 10 seconds to 5 minutes I get the error

Current code

  if (!stop) {
      while (this.buffer.length >= offset + size + value) {
        try {
          this.push(this.buffer.slice(offset + size, offset + size + value))
          offset += size + value;
          ({ value, size } = readVarInt(this.buffer, offset))
        } catch (e) {
          if (e.partialReadError) {
            break
          }
        }
      }
    }

Expected behavior

I don't know as this is from a npm plugin, I just know its not supposed to do that

Additional context

Add any other context about the problem here.

wvffle commented 4 years ago

Please, update your issue with required info.

overtimepog commented 4 years ago

Ok, the only problem is I don’t know what in my code causes that, it just randomly happens

wvffle commented 4 years ago

also, without full error stack it's harder for us to locate the potential bug

Karang commented 4 years ago

@0vertime-dev You need to provide the full error stack and a minimal example (of your code) to reproduce the issue.