{"record":{"id":"406e352eb5dbd3d9","repo":"moeru-ai/airi","slug":"resource-missing","errorCode":"RESOURCE_MISSING","errorMessage":"Failed to collect any ${type}","messagePattern":"Failed to collect any (.+?)","errorType":"error_code","errorClass":"ActionError","httpStatus":null,"severity":"error","filePath":"integrations/minecraft/src/cognitive/action/llm-actions.ts","lineNumber":269,"sourceCode":"    },\n  },\n  {\n    name: 'collectBlocks',\n    description: 'Automatically collect the nearest blocks of a given type.',\n    execution: 'async',\n    // NOTICE: detach auto-follow before mining. The idle auto-follow reflex drives the same\n    // mineflayer pathfinder as digging; if left attached it periodically re-points the bot at the\n    // followed player, which both cancels navigation to the ore (\"Path was stopped\") and aborts the\n    // in-progress bot.dig (\"Digging aborted\"), producing the stutter of repeated half-digs.\n    followControl: 'detach',\n    schema: z.object({\n      type: z.string().describe('The block type to collect.'),\n      num: z.number().int().describe('The number of blocks to collect.').min(1),\n    }),\n    perform: mineflayer => async (type: string, num: number) => {\n      const collected = await collectBlock(mineflayer, type, num)\n      if (collected <= 0) {\n        throw new ActionError('RESOURCE_MISSING', `Failed to collect any ${type}`, { type, requested: num, collected })\n      }\n      return `Collected [${type}] x${collected}`\n    },\n  },\n  {\n    name: 'mineBlockAt',\n    description: 'Mine (break) a block at a specific position. Do NOT use this for regular resource collection. Use collectBlocks instead.',\n    execution: 'async',\n    // NOTICE: detach auto-follow before mining (same reason as collectBlocks) so the follow reflex\n    // cannot interrupt bot.dig mid-break.\n    followControl: 'detach',\n    schema: z.object({\n      x: z.number().describe('The x coordinate.'),\n      y: z.number().describe('The y coordinate.'),\n      z: z.number().describe('The z coordinate.'),\n      expected_block_type: z.string().optional().describe('Optional: expected block type at the position (e.g. oak_log). If provided and mismatched, the action fails.'),\n    }),\n    perform: mineflayer => async (x: number, y: number, z: number, expected_block_type?: string) => {","sourceCodeStart":251,"sourceCodeEnd":287,"githubUrl":"https://github.com/moeru-ai/airi/blob/27111382b4a79a7e983289d6e983a06af185ed0f/integrations/minecraft/src/cognitive/action/llm-actions.ts#L251-L287","documentation":"Thrown by the collectBlocks action (ActionError code RESOURCE_MISSING) when collectBlock returns 0 collected items. The action wraps mineflayer-embedded-toolkit's collectBlock; a zero result means no matching block was found in range, the bot could not path to any, or mining was interrupted. Context carries { type, requested, collected }.","triggerScenarios":"Requesting a block type not present near the bot (e.g. 'diamond_ore' when underground without any); the block alias resolves to nothing matchesBlockAlias can map; pathfinding failed for all candidates; inventory full so pickup never registered.","commonSituations":"LLM asks to collect a resource in a biome where it does not spawn; chunk not loaded so blockAt scans find nothing; bot encumbered/falling so pathfinder cannot route; alias mismatch between the LLM's term and the registered block names.","solutions":["Move the bot to a biome/area where the block type actually generates before reissuing.","Confirm the type alias is recognized by matchesBlockAlias; use the canonical minecraft block name.","Clear inventory space or stash items so pickups can register.","Ensure the chunk is loaded (bot is standing in it) before collecting."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await performAction({ tool: 'collectBlocks', params: { type, num } })\n} catch (e) {\n  if (e.code === 'RESOURCE_MISSING')\n    // reposition bot to a biome where the block spawns, then retry\n  throw e\n}","preventionTips":["Confirm the block type spawns in the current biome before collecting.","Use canonical minecraft block names or verified aliases.","Ensure inventory has space and the chunk is loaded."],"tags":["minecraft","action","resource","llm-actions","pathfinding"],"backgroundTag":null,"analyzedSha":"27111382b4a79a7e983289d6e983a06af185ed0f","analyzedAt":"2026-08-12T18:33:34.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}