moeru-ai/airi · warning · ActionError
RESOURCE_MISSING
RESOURCE_MISSING
Error message
Don't have right tools to break ${block.name} What it means
Thrown by breakBlockAt (world-interactions.ts:267) with code RESOURCE_MISSING when, in non-creative mode, after equipping a tool via bot.tool.equipForBlock(block) the held item cannot harvest the block (block.canHarvest(itemId) returns false). This means the correct tool tier is missing — e.g. diamond needed for obsidian, iron for diamond ore. Context payload is { blockType: block.name }.
Source
Thrown at integrations/minecraft/src/skills/actions/world-interactions.ts:267
// Log game mode
logger.log(`Game mode: ${mineflayer.bot.game.gameMode}`)
if (distance > 4.5) {
logger.log(`Moving to block position ${targetPos}`)
await goToPosition(mineflayer, targetPos.x, targetPos.y, targetPos.z)
}
if (mineflayer.bot.game.gameMode !== 'creative') {
logger.log(`Equipping tool for block: ${block.name}`)
await mineflayer.bot.tool.equipForBlock(block)
const heldItem = mineflayer.bot.heldItem
logger.log(`Held item: ${heldItem?.name || 'none'}`)
const itemId = heldItem ? heldItem.type : null
logger.log(`Can harvest block: ${block.canHarvest(itemId)}`)
if (!block.canHarvest(itemId)) {
logger.log(`Don't have right tools to break ${block.name}.`)
throw new ActionError('RESOURCE_MISSING', `Don't have right tools to break ${block.name}`, { blockType: block.name })
}
}
logger.log(`Can dig block: ${mineflayer.bot.canDigBlock(block)}`)
if (!mineflayer.bot.canDigBlock(block)) {
logger.log(`Cannot break ${block.name} at ${targetPos}.`)
throw new ActionError('UNKNOWN', `Cannot break ${block.name} at ${targetPos}`, { blockType: block.name, position: targetPos })
}
logger.log(`Looking at block ${block.position}`)
await mineflayer.bot.lookAt(block.position, true) // Ensure the bot has finished turning
await sleep(500)
try {
logger.log(`Starting to dig block ${block.name} at ${block.position}`)
// Increase digging time to ensure block is fully broken
await mineflayer.bot.dig(block, true)
await sleep(1000) // Wait for block to breakView on GitHub (pinned to 27111382b4)
Solutions
- Equip a higher-tier pickaxe before calling (e.g. craft/carry iron or diamond).
- Use creative mode if tooling is unavailable (gameMode === 'creative' bypasses the check).
- Pre-check block.harvests in minecraft-data for the required tool tier and stock accordingly.
- Catch RESOURCE_MISSING and trigger a 'gear up' fallback (craft, trade, or takeFromChest the right tool).
Example fix
// before await breakBlockAt(bot, x, y, z) // on diamond ore with wooden pickaxe // after await takeFromChest(bot, 'iron_pickaxe', 1) await equip(bot, 'iron_pickaxe') await breakBlockAt(bot, x, y, z)
Defensive patterns
Strategy: validation
Validate before calling
if (mineflayer.bot.game.gameMode !== 'creative') {
const toolNames = mineflayer.bot.inventory.items().map(i => i.name)
const hasBetter = ['iron_pickaxe','diamond_pickaxe'].some(n => toolNames.includes(n))
if (!hasBetter) await takeFromChest(mineflayer, 'iron_pickaxe', 1)
}
await breakBlockAt(mineflayer, x, y, z) Type guard
const hasToolTier = (bot: Mineflayer, tiers: string[]): boolean => bot.bot.inventory.items().some(i => tiers.includes(i.name))
Try / catch
try {
await breakBlockAt(mineflayer, x, y, z)
} catch (e) {
if (e instanceof ActionError && e.code === 'RESOURCE_MISSING') {
await takeFromChest(mineflayer, 'iron_pickaxe', 1)
await breakBlockAt(mineflayer, x, y, z)
} else throw e
} Prevention
- Always carry at least an iron pickaxe in survival mining operations.
- Look up block.harvestTools in minecraft-data to know the required tier.
- Use creative mode when tooling is unavailable (bypasses the canHarvest check).
When it happens
Trigger: Call breakBlockAt on a block that requires a higher tool tier than the bot has: obsidian needs diamond pickaxe, diamond ore needs iron pickaxe, iron ore needs stone pickaxe. The tool is equipped first, but if no suitable tool exists the canHarvest check fails.
Common situations: Bot only carries a wooden/stone pickaxe, the required tool is in a chest not inventory, the bot just started and only has a starter pickaxe, or the player低估 the tier needed for the block.
Related errors
AI-assisted analysis of moeru-ai/airi@27111382b4 (2026-08-12).
Data as JSON: /api/errors/d6d4134996f0e3af.
Report an issue: GitHub.