Voyager icon indicating copy to clipboard operation
Voyager copied to clipboard

AssertionError [ERR_ASSERTION]: plugin needs to be a function

Open uwFengyuan opened this issue 11 months ago • 8 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.

...

uwFengyuan avatar Mar 14 '24 09:03 uwFengyuan

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

dawn0815 avatar Mar 22 '24 02:03 dawn0815

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

Y-Claw avatar Mar 23 '24 00:03 Y-Claw

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;

dawn0815 avatar Mar 23 '24 12:03 dawn0815

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.

Y-Claw avatar Mar 24 '24 07:03 Y-Claw

thank you very much!!!!!!!

WZX0Swarm0Robotics avatar Mar 28 '24 05:03 WZX0Swarm0Robotics

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

github-actions[bot] avatar Apr 28 '24 01:04 github-actions[bot]

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

murphybread avatar Apr 28 '24 10:04 murphybread

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.

ALenTiger avatar Apr 30 '24 01:04 ALenTiger

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.

usamimeri avatar May 23 '24 07:05 usamimeri

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

github-actions[bot] avatar Jun 23 '24 01:06 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar Jul 07 '24 01:07 github-actions[bot]

it worked for me too thank you.

ahfmrptEkd avatar Jul 28 '24 11:07 ahfmrptEkd