mineflayer icon indicating copy to clipboard operation
mineflayer copied to clipboard

Unable to connect bot to server due to proxy settings hindering the connection process (Bug)

Open OmegaM1 opened this issue 1 year ago • 15 comments

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

Your current code

I get the error code below when I try to execute my main node

     Error: connect ECONNREFUSED 54.38.216.200:25565
        at createConnectionError (node:net:1648:14)
        at afterConnectMultiple (node:net:1678:16) {
      errno: -111,
      code: 'ECONNREFUSED',
      syscall: 'connect',
      address: '54.38.216.200',
      port: 25565
    }
  ]
}
AggregateError [ECONNREFUSED]: 
    Error: connect ECONNREFUSED 54.38.216.200:25565
        at createConnectionError (node:net:1648:14)
        at afterConnectMultiple (node:net:1678:16) {
      errno: -111,
      code: 'ECONNREFUSED',
      syscall: 'connect',
      address: '54.38.216.200',
      port: 25565
    }
  ]
}
Chunk size is 5 but only 1 was read ; partial packet : {"name":0}; buffer :0005000001
Chunk size is 259 but only 1 was read ; partial packet : {"name":123}; buffer :7b2274657874223a22c2a737c2a76d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d5c6ec2a763496e76616c696420686f73746e616d652e5c6ec2a763506c6561736520726566657220746f206f757220646f63756d656e746174696f6e20617420646f63732e746370736869656c642e636f6d5c6e5c6ec2a76644446f532070726f74656374696f6e20627920c2a762c2a76e544350536869656c642e636f6d5c6ec2a737c2a76d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d227d

Would be appreciated for your solution

OmegaM1 avatar Aug 13 '24 18:08 OmegaM1

im having same problem where it cant join but im getting this error /home/container/node_modules/mineflayer/lib/plugins/game.js:46 const { minY, height } = bot.registry.dimensionsByName[bot.game.dimension] ^ TypeError: Cannot read properties of undefined (reading 'overworld') at handleRespawnPacketData (/home/container/node_modules/mineflayer/lib/plugins/game.js:46:63) at Client.<anonymous> (/home/container/node_modules/mineflayer/lib/plugins/game.js:80:5) at Client.emit (node:events:531:35) at Client.emit (node:domain:488:12) at emitPacket (/home/container/node_modules/minecraft-protocol/src/client.js:83:12) at FullPacketParser.<anonymous> (/home/container/node_modules/minecraft-protocol/src/client.js:112:9) at FullPacketParser.emit (node:events:519:28) at FullPacketParser.emit (node:domain:488:12) at addChunk (/home/container/node_modules/protodef/node_modules/readable-stream/lib/_stream_readable.js:279:12) at readableAddChunk (/home/container/node_modules/protodef/node_modules/readable-stream/lib/_stream_readable.js:262:11)`

BallisticOK avatar Aug 14 '24 09:08 BallisticOK

im having same problem where it cant join but im getting this error /home/container/node_modules/mineflayer/lib/plugins/game.js:46 const { minY, height } = bot.registry.dimensionsByName[bot.game.dimension] ^ TypeError: Cannot read properties of undefined (reading 'overworld') at handleRespawnPacketData (/home/container/node_modules/mineflayer/lib/plugins/game.js:46:63) at Client.<anonymous> (/home/container/node_modules/mineflayer/lib/plugins/game.js:80:5) at Client.emit (node:events:531:35) at Client.emit (node:domain:488:12) at emitPacket (/home/container/node_modules/minecraft-protocol/src/client.js:83:12) at FullPacketParser.<anonymous> (/home/container/node_modules/minecraft-protocol/src/client.js:112:9) at FullPacketParser.emit (node:events:519:28) at FullPacketParser.emit (node:domain:488:12) at addChunk (/home/container/node_modules/protodef/node_modules/readable-stream/lib/_stream_readable.js:279:12) at readableAddChunk (/home/container/node_modules/protodef/node_modules/readable-stream/lib/_stream_readable.js:262:11)`

that must be a client-side bug I'm not sure about this, but if I was you I would just delete my mineflayer package and re-install it again may it fixes.

My bots file is running on an online hosting service so error I get is probably related to NATing and networks ig so idk how to fix that

OmegaM1 avatar Aug 14 '24 12:08 OmegaM1

i got it working just cant use mc over 1.18 if i go over that i get the error so for now im just using via on my server and making it use 1.18 to join

BallisticOK avatar Aug 14 '24 23:08 BallisticOK

Please verify that you can connect to the server with a vanilla client first

extremeheat avatar Aug 16 '24 23:08 extremeheat

Please verify that you can connect to the server with a vanilla client first

I can always connect to the server with my mc client without any problems but idk why the bots can't I think there's a firewall from the server side that may blocking the bots connection

OmegaM1 avatar Aug 17 '24 12:08 OmegaM1

Same issue as this one here. ive done testing on this and it happens when server is running 1.19 or higher and bot tries to join with anything above 1.18. Clients can join just fine but not bots. Bots on 1.18 can join the server since the server has via version on it and work fine just cant go below the world limit of 1.18.

https://github.com/PrismarineJS/mineflayer/issues/3435

TinyTank800 avatar Aug 17 '24 18:08 TinyTank800

I've tried every version still getting the same error

Chunk size is 5 but only 1 was read ; partial packet : {"name":0}; buffer :0005000001
serializer.js:76
Chunk size is 259 but only 1 was read ; partial packet : {"name":123}; buffer :7b2274657874223a22c2a737c2a76d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d5c6ec2a763496e76616c696420686f73746e616d652e5c6ec2a763506c6561736520726566657220746f206f757220646f63756d656e746174696f6e20617420646f63732e746370736869656c642e636f6d5c6e5c6ec2a76644446f532070726f74656374696f6e20627920c2a762c2a76e544350536869656c642e636f6d5c6ec2a737c2a76d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d227d
Error: connect ETIMEDOUT 142.54.229.243:4145
    at TCPConnectWrap.afterConnect [as oncomplete] (c:\net.js:1595:16)
    at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {errno: -4039, code: 'ETIMEDOUT', syscall: 'connect', address: '142.54.229.243', port: 4145, …}

OmegaM1 avatar Aug 18 '24 17:08 OmegaM1

Same issue and same error here, When I use socks proxies for my mineflayer bot I keep getting the error above but it works fine when I don't configure proxies for my bot.

Alexandersys avatar Aug 19 '24 11:08 Alexandersys

If the connection is refused this is an issue with the server or your network connection. Try on a different server and see if you can reproduce. There are other comments on this issue that are not related to OP problem.

extremeheat avatar Aug 20 '24 18:08 extremeheat

If it's a proxy issue then we can't fix it, we can only fix problems directly caused by the code

extremeheat avatar Aug 20 '24 18:08 extremeheat

Yeah I just realized it works without setting proxy but the issue is there's a minecraft server that doesn't let you join your bots with your same IP so somehow you gotta bypass it using proxies.

OmegaM1 avatar Aug 20 '24 19:08 OmegaM1

Yeah I just realized it works without setting proxy but the issue is there's a minecraft server that doesn't let you join your bots with your same IP so somehow you gotta bypass it using proxies.

Are you setting the proxy right within the mineflayer script or are you using something like proxychains4?

Maximapple avatar Aug 20 '24 20:08 Maximapple

It was working fine for me a few weeks or months ago, but since I updated my version of mineflayer to the latest version, it keeps sending me this error, and I've been ensured several times that there isn't any problem with proxies.

OmegaM1 avatar Aug 20 '24 20:08 OmegaM1

Are you setting the proxy right within the mineflayer script or are you using something like proxychains4?

I'm currently using socks5-client

OmegaM1 avatar Aug 20 '24 20:08 OmegaM1

This is the code example of how I configure the proxies

const mineflayer = require('mineflayer')
const Socks = require("socks5-client");

const bot = mineflayer.createBot({
stream: Socks.createConnection({
  host: "192.168.1.1",
  port: "25565",
  socksHost: "1.0.0.1",
  socksPort: 4145
}),
  username: 'IamBot',
  password: '',
  version: 1.20,
})

OmegaM1 avatar Aug 20 '24 20:08 OmegaM1