moeru-ai/airi · error · ActionError
RESOURCE_MISSING
RESOURCE_MISSING
Error message
Could not gather wood
What it means
Thrown by ensurePlanks() as an ActionError with code RESOURCE_MISSING. When the bot has no logs in inventory and needs planks, it calls gatherWood(mineflayer, logsNeeded, 80). If gatherWood itself throws (no trees in range, pathfinder failure, or the gather implementation rejected), the catch wraps it into 'Could not gather wood' with the original error preserved in context.originalError. This is a resource-acquisition failure: the bot cannot source raw logs to make planks.
Source
Thrown at integrations/minecraft/src/skills/actions/ensure.ts:60
let retries = 0
while (neededAmount > planksCount && retries < maxRetries) {
retries++
const logsNeeded = Math.ceil((neededAmount - planksCount) / PLANKS_PER_LOG)
// Get all available log types in inventory
const availableLogs = mineflayer.bot.inventory
.items()
.filter(item => item.name.includes('log'))
// If no logs available, gather more wood
if (availableLogs.length === 0) {
logger.log(`Bot: Not enough logs. Gathering ${logsNeeded} logs.`)
try {
await gatherWood(mineflayer, logsNeeded, 80)
}
catch (error) {
throw new ActionError('RESOURCE_MISSING', 'Could not gather wood', { item: 'log', count: logsNeeded, originalError: error })
}
// Check if we actually got wood
const newLogs = mineflayer.bot.inventory.items().filter(item => item.name.includes('log'))
if (newLogs.length === 0) {
throw new ActionError('RESOURCE_MISSING', 'Gathered wood but inventory still empty of logs', { item: 'log' })
}
// Continue to next iteration to craft
continue
}
// Iterate over each log type to craft planks
let anyCrafted = false
for (const log of availableLogs) {
const logType = log.name.replace('_log', '') // Get log type without "_log" suffix
const logsToCraft = Math.min(log.count, logsNeeded)
logger.log(`Trying to make ${logsToCraft * PLANKS_PER_LOG} ${logType}_planks`)View on GitHub (pinned to 27111382b4)
Solutions
- Move the bot to a forest/jungle biome before requiring planks.
- Catch ActionError RESOURCE_MISSING and fall back to trading, looting chests, or asking a player for logs.
- Inspect context.originalError to find the underlying gatherWood failure (pathfinder vs. no-target).
- Increase the gather radius or pre-stock logs via ensurePlanks' inventory check before they are needed.
Example fix
// before
// await ensurePlanks(mineflayer, 4) // throws RESOURCE_MISSING: Could not gather wood
//
// after
// try {
// await ensurePlanks(mineflayer, 4)
// } catch (e) {
// if (e instanceof ActionError && e.code === 'RESOURCE_MISSING') {
// await chat({ message: 'No wood nearby — please place logs near me' })
// return
// }
// throw e
// } Defensive patterns
Strategy: try-catch
Validate before calling
// Pre-stock logs so gather is unnecessary:
// import { getItemCount } from './inventory'
// if (getItemCount(mineflayer, 'log') < 1) {
// // move to a forest biome first, or request logs from a player
// } Type guard
function isResourceMissing(e: unknown): e is { code: 'RESOURCE_MISSING', context?: { originalError?: unknown }, message: string } {
return e instanceof Error && (e as any).name === 'ActionError' && (e as any).code === 'RESOURCE_MISSING'
} Try / catch
// try {
// await ensurePlanks(mineflayer, 4)
// } catch (e) {
// if (isResourceMissing(e)) {
// await chat({ message: 'No wood nearby; please place logs near me' })
// return
// }
// throw e
// } Prevention
- Move to a tree-rich biome before requiring planks.
- Inspect context.originalError to find the underlying gatherWood cause.
- Catch RESOURCE_MISSING and fall back to trading/chests/player help.
- Pre-stock logs so the gather path is not reached.
When it happens
Trigger: No trees within the 80-block gather radius; trees exist but pathfinder cannot reach them (terrain, water, claims); gatherWood threw because the bot is stuck or low on health; the world has no logs at all (superflat, desert).
Common situations: Bot spawned in a treeless biome; gathered area depleted and no nearer trees; pathfinder stuck in a hole or surrounded by water; server anti-cheat blocking block breaking; gatherWood called while the bot is mid-combat or falling.
Related errors
AI-assisted analysis of moeru-ai/airi@27111382b4 (2026-08-12).
Data as JSON: /api/errors/4490eed806b7ecbf.
Report an issue: GitHub.