moeru-ai/airi · warning · Error
Could not find any ${blockType} in ${range} blocks.
Error message
Could not find any ${blockType} in ${range} blocks. What it means
Thrown by goToNearestBlock when getNearestBlock(mineflayer, blockType, range) returns null — no block of blockType was found within the search range (capped at MAX_RANGE = 512). This is a plain Error (not an ActionError) raised before any pathfinding begins, so the navigation never starts.
Source
Thrown at integrations/minecraft/src/skills/movement.ts:105
return result
}
export async function goToNearestBlock(
mineflayer: Mineflayer,
blockType: string,
minDistance = 2,
range = 64,
): Promise<Block> {
const MAX_RANGE = 512
if (range > MAX_RANGE) {
log(mineflayer, `Maximum search range capped at ${MAX_RANGE}.`)
range = MAX_RANGE
}
const block = getNearestBlock(mineflayer, blockType, range)
if (!block) {
throw new Error(`Could not find any ${blockType} in ${range} blocks.`)
}
log(mineflayer, `Found ${blockType} at ${block.position}.`)
const result = await goToPosition(mineflayer, block.position.x, block.position.y, block.position.z, minDistance)
if (!result.ok) {
throw new Error(`Failed to reach ${blockType}: ${result.reason} — ${result.message}`)
}
return block
}
export async function goToNearestEntity(
mineflayer: Mineflayer,
entityType: string,
minDistance = 2,
range = 64,
): Promise<boolean> {
const entity = getNearestEntityWhere(
mineflayer,View on GitHub (pinned to 27111382b4)
Solutions
- Increase the range parameter (up to the 512 cap) to scan a larger area.
- Explore/move the bot to load new chunks before searching.
- Verify blockType is a valid registry name and actually exists in the current biome/dimension.
- Call getNearestBlock directly first to detect absence without throwing, then react.
Example fix
// before
await goToNearestBlock(mineflayer, 'diamond_ore', 2, 64)
// after
const b = getNearestBlock(mineflayer, 'diamond_ore', 128)
if (!b) {
// explore to load more chunks
return
}
await goToNearestBlock(mineflayer, 'diamond_ore', 2, 128) Defensive patterns
Strategy: validation
Validate before calling
import { getNearestBlock } from '../world'
const block = getNearestBlock(mineflayer, blockType, range)
if (!block) {
// explore to load new chunks, or widen range
throw new Error(`No ${blockType} within ${range} blocks`)
}
await goToNearestBlock(mineflayer, blockType, minDistance, range) Type guard
function isBlockNotFoundError(e: unknown): boolean {
return e instanceof Error && /Could not find any .* in .* blocks\./.test(e.message)
} Try / catch
let range = 64
while (range <= 512) {
try {
return await goToNearestBlock(mineflayer, blockType, minDistance, range)
} catch (e) {
if (e instanceof Error && /Could not find any/.test(e.message)) {
range = Math.min(range * 2, 512)
} else throw e
}
}
throw new Error(`${blockType} not found within 512 blocks`) Prevention
- Call getNearestBlock directly to detect absence without throwing.
- Widen the range progressively (up to the 512 cap) before giving up.
- Explore/load new chunks before searching for rare blocks.
When it happens
Trigger: Calling goToNearestBlock(mineflayer, 'diamond_ore', 2, 64) when no diamond_ore block is loaded within 64 blocks; the blockType is valid but absent from the scanned area; the bot's loaded chunks do not contain the target.
Common situations: Searching for a rare ore without exploring; target block is outside loaded chunks; block type exists but is buried/obscured; searching near spawn where the resource has been mined out.
Related errors
- TARGET_NOT_FOUND
- NAVIGATION_FAILED
- Failed to reach ${blockType}: ${result.reason} — ${result.me
- Unknown action: ${step.tool}
- RESOURCE_MISSING
AI-assisted analysis of moeru-ai/airi@27111382b4 (2026-08-12).
Data as JSON: /api/errors/c6adc0840326df9a.
Report an issue: GitHub.