MineDojo/Voyager

AssertionError [ERR_ASSERTION]: plugin needs to be a function

uwFengyuan opened this issue · 12 comments

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.

...

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

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

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;

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 very much!!!!!!!

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

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

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.