Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AssertionError [ERR_ASSERTION]: plugin needs to be a function #148

Open
uwFengyuan opened this issue Mar 14, 2024 · 9 comments
Open

AssertionError [ERR_ASSERTION]: plugin needs to be a function #148

uwFengyuan opened this issue Mar 14, 2024 · 9 comments

Comments

@uwFengyuan
Copy link

uwFengyuan commented Mar 14, 2024

Before submitting an issue, make sure you read the FAQ.md

Briefly describe your issue

I have the following errors:

requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

when I run the following code:

voyager = Voyager(
mc_port=mc_port,
openai_api_key=openai_api_key,
)

voyager.learn()

Please provide your python, nodejs, Minecraft, and Fabric versions here

I use Windows 11 and Ubuntu22.04.3(WSL) to run the code. Minecraft is downloaded in Windows 11.
python version: 3.11.8
node version: v20.0.0
Minecraft 1.19
Fabric 0.14.18

[If applicable] Please provide the Minefalyer and Minecraft logs, you can find the log under logs folder

2024-03-16 17:40:17,700 - mineflayer - INFO - Stopping subprocess.
2024-03-16 17:40:18,701 - mineflayer - INFO - Starting subprocess with commands: ['node', '/home/Voyager/voyager/env/mineflayer/index.js', '3000']
2024-03-16 17:40:19,119 - mineflayer - INFO - Server started on port 3000
2024-03-16 17:40:19,119 - mineflayer - INFO - Subprocess is ready.
2024-03-16 17:40:19,131 - mineflayer - INFO - {
2024-03-16 17:40:19,132 - mineflayer - INFO - port: 36791,
2024-03-16 17:40:19,132 - mineflayer - INFO - reset: 'hard',
2024-03-16 17:40:19,132 - mineflayer - INFO - inventory: {},
2024-03-16 17:40:19,132 - mineflayer - INFO - equipment: [],
2024-03-16 17:40:19,132 - mineflayer - INFO - spread: false,
2024-03-16 17:40:19,132 - mineflayer - INFO - waitTicks: 20,
2024-03-16 17:40:19,132 - mineflayer - INFO - position: null
2024-03-16 17:40:19,132 - mineflayer - INFO - }
2024-03-16 17:40:27,064 - mineflayer - INFO - Mineflayer detected that you are using a deprecated event (physicTick)! Please use this event (physicsTick) instead.
2024-03-16 17:40:27,067 - mineflayer - INFO - node:internal/process/promises:289
2024-03-16 17:40:27,067 - mineflayer - INFO - triggerUncaughtException(err, true /* fromPromise */);
2024-03-16 17:40:27,067 - mineflayer - INFO - ^
2024-03-16 17:40:27,067 - mineflayer - INFO -
2024-03-16 17:40:27,067 - mineflayer - INFO - AssertionError [ERR_ASSERTION]: plugin needs to be a function
2024-03-16 17:40:27,067 - mineflayer - INFO - at EventEmitter.loadPlugin (/home/Voyager/voyager/env/mineflayer/node_modules/mineflayer/lib/plugin_loader.js:16:12)
2024-03-16 17:40:27,067 - mineflayer - INFO - at EventEmitter. (/home/Voyager/voyager/env/mineflayer/index.js:107:13)
2024-03-16 17:40:27,067 - mineflayer - INFO - at Object.onceWrapper (node:events:625:28)
2024-03-16 17:40:27,067 - mineflayer - INFO - at EventEmitter.emit (node:events:523:35)
2024-03-16 17:40:27,067 - mineflayer - INFO - at Client. (/home/Voyager/voyager/env/mineflayer/node_modules/mineflayer/lib/plugins/health.js:31:11)
2024-03-16 17:40:27,067 - mineflayer - INFO - at Client.emit (node:events:511:28)
2024-03-16 17:40:27,067 - mineflayer - INFO - at emitPacket (/home/Voyager/voyager/env/mineflayer/node_modules/minecraft-protocol/src/client.js:83:12)
2024-03-16 17:40:27,067 - mineflayer - INFO - at FullPacketParser. (/home/Voyager/voyager/env/mineflayer/node_modules/minecraft-protocol/src/client.js:112:9)
2024-03-16 17:40:27,067 - mineflayer - INFO - at FullPacketParser.emit (node:events:511:28)
2024-03-16 17:40:27,067 - mineflayer - INFO - at addChunk (/home/Voyager/voyager/env/mineflayer/node_modules/protodef/node_modules/readable-stream/lib/_stream_readable.js:279:12) {
2024-03-16 17:40:27,067 - mineflayer - INFO - generatedMessage: false,
2024-03-16 17:40:27,067 - mineflayer - INFO - code: 'ERR_ASSERTION',
2024-03-16 17:40:27,067 - mineflayer - INFO - actual: false,
2024-03-16 17:40:27,068 - mineflayer - INFO - expected: true,
2024-03-16 17:40:27,068 - mineflayer - INFO - operator: '=='
2024-03-16 17:40:27,068 - mineflayer - INFO - }
2024-03-16 17:40:27,068 - mineflayer - INFO -
2024-03-16 17:40:27,068 - mineflayer - INFO - Node.js v20.0.0

[If applicable] Please provide the GPT conversations that are printed each round.

...

@uwFengyuan uwFengyuan changed the title Connection Issues AssertionError [ERR_ASSERTION]: plugin needs to be a function Mar 16, 2024
@dawn0815
Copy link

Hi, I'm having the same problem. Is there a solution for it yet? Thanks.

@Y-Claw
Copy link

Y-Claw commented Mar 23, 2024

I've encountered the same problem, have you solved it? Thank you.

@dawn0815
Copy link

dawn0815 commented Mar 23, 2024

in ./voyager/env/mineflayer/index.js
line 102~110,
comment out lines 102 and line 107, uncomment line 109 and 110 like below, this works for me!

  //const minecraftHawkEye = require("minecrafthawkeye");
    bot.loadPlugin(pathfinder);
    bot.loadPlugin(tool);
    bot.loadPlugin(collectBlock);
    bot.loadPlugin(pvp);
 //bot.loadPlugin(minecraftHawkEye);

    bot.collectBlock.movements.digCost = 0;
    bot.collectBlock.movements.placeCost = 0;

@Y-Claw
Copy link

Y-Claw commented Mar 24, 2024

in ./voyager/env/mineflayer/index.js line 102~110, comment out lines 102 and line 107, uncomment line 109 and 110 like below, this works for me!

  //const minecraftHawkEye = require("minecrafthawkeye");
    bot.loadPlugin(pathfinder);
    bot.loadPlugin(tool);
    bot.loadPlugin(collectBlock);
    bot.loadPlugin(pvp);
 //bot.loadPlugin(minecraftHawkEye);

    bot.collectBlock.movements.digCost = 0;
    bot.collectBlock.movements.placeCost = 0;

Thank you very much. Inspired by you, I went to check Minecrafthawkeye. I find that Minecrafthawkeye was updated last week, and it seems to have some compatibility issues with the mineflayer code. I try fixed it by changing "minecrafthawkeye": "^1.3.6" to "minecrafthawkeye": "1.3.6" in voyager/env/mineflayer/package.json and reinstall mineflayer. This seems to also solve the problem.

@WZX0Swarm0Robotics
Copy link

thank you very much!!!!!!!

Copy link

This issue is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale label Apr 28, 2024
@murphybread
Copy link

in ./voyager/env/mineflayer/index.js line 102~110, comment out lines 102 and line 107, uncomment line 109 and 110 like below, this works for me!

  //const minecraftHawkEye = require("minecrafthawkeye");
    bot.loadPlugin(pathfinder);
    bot.loadPlugin(tool);
    bot.loadPlugin(collectBlock);
    bot.loadPlugin(pvp);
 //bot.loadPlugin(minecraftHawkEye);

    bot.collectBlock.movements.digCost = 0;
    bot.collectBlock.movements.placeCost = 0;

Thanks a lot

@github-actions github-actions bot removed the stale label Apr 29, 2024
@ALenTiger
Copy link

in ./voyager/env/mineflayer/index.js line 102~110, comment out lines 102 and line 107, uncomment line 109 and 110 like below, this works for me!

  //const minecraftHawkEye = require("minecrafthawkeye");
    bot.loadPlugin(pathfinder);
    bot.loadPlugin(tool);
    bot.loadPlugin(collectBlock);
    bot.loadPlugin(pvp);
 //bot.loadPlugin(minecraftHawkEye);

    bot.collectBlock.movements.digCost = 0;
    bot.collectBlock.movements.placeCost = 0;

OMG I COULD KISS YOU! This was a hail merry. I was close to giving up. This worked for me.

@usamimeri
Copy link

in ./voyager/env/mineflayer/index.js line 102~110, comment out lines 102 and line 107, uncomment line 109 and 110 like below, this works for me!

  //const minecraftHawkEye = require("minecrafthawkeye");
    bot.loadPlugin(pathfinder);
    bot.loadPlugin(tool);
    bot.loadPlugin(collectBlock);
    bot.loadPlugin(pvp);
 //bot.loadPlugin(minecraftHawkEye);

    bot.collectBlock.movements.digCost = 0;
    bot.collectBlock.movements.placeCost = 0;

Thank you very much. Inspired by you, I went to check Minecrafthawkeye. I find that Minecrafthawkeye was updated last week, and it seems to have some compatibility issues with the mineflayer code. I try fixed it by changing "minecrafthawkeye": "^1.3.6" to "minecrafthawkeye": "1.3.6" in voyager/env/mineflayer/package.json and reinstall mineflayer. This seems to also solve the problem.

Thank you! It worked for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants