MineDojo/Voyager

ISSUE:Your last round rollout terminated due to error: list index out of range

Raven-July opened this issue · 3 comments

issue:
I successfully installed voyager,and then launched the program.
It seems that no matter how long i wait ,'list index out of range' keeps happening.
屏幕截图 2024-01-23 211404

environment:
python==3.10
Minecraft==1.18.2
Fabric version==0.15.3

Minefalyer logs as follow:
20240123_210530.log

GPT conversations that are printed each round:(one round for example)

Mineflayer process has exited, restarting
Subprocess mineflayer started with PID 31956.
Server started on port 3000

Render Action Agent system message with 0 skills
Action Agent human message
Code from the last round: No code in the first round

Execution error: No error

Chat log: None

Biome: sunflower_plains

Time: noon

Nearby blocks: dirt, grass_block, grass, tall_grass, sunflower

Nearby entities (nearest to farthest): None

Health: 20.0/20

Hunger: 20.0/20

Position: x=7.5, y=86.0, z=-3.5

Equipment: [None, None, None, None, None, None]

Inventory (0/36): Empty

Chests: None

Task: Mine 1 wood log

Context: You can mine one of oak, birch, spruce, jungle, acacia, dark oak, or mangrove logs.

Critique: None

Action Agent ai message
Explain: Since your inventory is empty and there are no nearby entities or chests, you will need to collect the wood log manually by mining it.

Plan:

  1. Use the mineBlock(bot, name, count) function to mine the wood log. Pass the name of the log you want to mine as the name parameter and set count to 1.
  2. Check if you have the wood log in your inventory. If not, repeat step 1 until you have it.

Code:

async function mineWoodLog(bot) {
  const logName = "oak_log"; // Change this to the type of log you want to mine
  const logCount = 1;

  while (true) {
    // Check if you already have the wood log in your inventory
    const woodLog = bot.inventory.findInventoryItem(mcData.itemsByName[logName].id);
    if (woodLog) {
      bot.chat(`I already have ${logName} in my inventory.`);
      break;
    }

    // Mine the wood log
    bot.chat(`Mining ${logName}...`);
    await mineBlock(bot, logName, logCount);
  }
}

mineWoodLog(bot);

Mineflayer process has exited, restarting
Subprocess mineflayer started with PID 31768.
Server started on port 3000

Your last round rollout terminated due to error:
list index out of range
Failed to complete task Mine 1 wood log. Skipping to next task.
Completed tasks:
Failed tasks: Mine 1 wood log, Mine 1 wood log
Starting task Mine 1 wood log for at most 4 times

The issue remains the same even if i tried to load a skill_library(./skill_library/trial1)

20240123_213648.log

GPT conversations are as follow:
Loading Skill Manager from ./skill_library/trial1/skill
Mineflayer process has exited, restarting
Subprocess mineflayer started with PID 30612.
Server started on port 3000

E:\Python_Projects\Voyager\venv\lib\site-packages\langchain_core_api\deprecation.py:117: LangChainDeprecationWarning: The function __call__ was deprecated in LangChain 0.1.7 and will be removed in 0.2.0. Use invoke instead.
warn_deprecated(
Curriculum Agent human message
Nearby blocks: dirt, grass_block, grass, stone, coal_ore, copper_ore

Position: x=3.5, y=83.0, z=4.5

Equipment: [None, None, None, None, None, None]

Inventory (0/36): Empty

Completed tasks so far: None

Failed tasks that are too hard: None

Curriculum Agent task decomposition
Final task: craft a wooden sword
Curriculum Agent task decomposition
["Craft 1 crafting_table", "Craft 4 wooden_planks", "Craft 2 sticks", "Craft 1 wooden_sword"]
Mineflayer process has exited, restarting
Subprocess mineflayer started with PID 30196.
Server started on port 3000

Curriculum Agent Question: How to craft 1 crafting table in Minecraft?
Curriculum Agent Answer: To craft a crafting table in Minecraft, you will need four wooden planks. Open your crafting table and place the wooden planks in a 2x2 grid. Once you have arranged the wooden planks in the correct pattern, you will see a crafting table appear in the result box. Simply click on it to add it to your inventory.
Starting task Craft 1 crafting_table for at most 4 times
Mineflayer process has exited, restarting
Subprocess mineflayer started with PID 33208.
Server started on port 3000

Skill Manager retrieving for 5 skills
Skill Manager retrieved skills: craftCraftingTable, craftChest, craftWoodenPickaxe, craftWoodenHoe, craftWoodenSword
Render Action Agent system message with 5 skills
Action Agent human message
Code from the last round: No code in the first round

Execution error: No error

Chat log: None

Biome: sunflower_plains

Time: night

Nearby blocks: dirt, grass_block, grass, stone, coal_ore, copper_ore

Nearby entities (nearest to farthest): chicken

Health: 20.0/20

Hunger: 20.0/20

Position: x=2.5, y=82.0, z=4.5

Equipment: [None, None, None, None, None, None]

Inventory (0/36): Empty

Chests: None

Task: Craft 1 crafting_table

Context: Question: How to craft 1 crafting table in Minecraft?
Answer: To craft a crafting table in Minecraft, you will need four wooden planks. Open your crafting table and place the wooden planks in a 2x2 grid. Once you have arranged the wooden planks in the correct pattern, you will see a crafting table appear in the result box. Simply click on it to add it to your inventory.

Critique: None

Action Agent ai message
Explain: The task is to craft 1 crafting table. To craft a crafting table, we need four wooden planks.

Plan:

  1. Check if there are enough wooden planks in the inventory.
  2. If there are not enough wooden planks, mine oak logs until we have enough.
  3. Craft the wooden planks into a crafting table.

Code:

async function craftCraftingTable(bot) {
  // Check if there are enough oak planks in the inventory
  const oakPlanksCount = bot.inventory.count(mcData.itemsByName.oak_planks.id);

  // If not, craft oak planks from oak logs
  if (oakPlanksCount < 4) {
    const oakLogsCount = bot.inventory.count(mcData.itemsByName.oak_log.id);
    const planksToCraft = Math.ceil((4 - oakPlanksCount) / 4);
    if (oakLogsCount >= planksToCraft) {
      await craftItem(bot, "oak_planks", planksToCraft);
      bot.chat("Crafted oak planks.");
    } else {
      bot.chat("Not enough oak logs to craft oak planks.");
      return;
    }
  }

  // Craft a crafting table using oak planks
  await craftItem(bot, "crafting_table", 1);
  bot.chat("Crafted a crafting table.");
}

// Call the function
await craftCraftingTable(bot);

Traceback (most recent call last):
File "E:\Python_Projects\Voyager\start.py", line 25, in
voyager.inference(sub_goals=sub_goals)
File "E:\Python_Projects\Voyager\voyager\voyager.py", line 400, in inference
messages, reward, done, info = self.rollout(
File "E:\Python_Projects\Voyager\voyager\voyager.py", line 290, in rollout
messages, reward, done, info = self.step()
File "E:\Python_Projects\Voyager\voyager\voyager.py", line 262, in step
self.recorder.record([], self.task)
File "E:\Python_Projects\Voyager\voyager\utils\record_utils.py", line 35, in record
events[0][1]["status"]["position"]["x"],
IndexError: list index out of range

i tried both gpt-4 and gpt-3.5-turbo,but it didn't help

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

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