moeru-ai/airi · warning · ActionError
TARGET_NOT_FOUND
TARGET_NOT_FOUND
Error message
No block found at ${targetDest} What it means
Thrown by placeBlock (world-interactions.ts:65) with code TARGET_NOT_FOUND when mineflayer.bot.blockAt(targetDest) returns null. blockAt returns null when the target chunk is not loaded or the coordinates are out of the world bounds; a loaded air block would return a Block object, not null. Context payload is { position: targetDest }.
Source
Thrown at integrations/minecraft/src/skills/actions/world-interactions.ts:65
if (!block && mineflayer.bot.game.gameMode === 'creative') {
const mcData = McData.fromBot(mineflayer.bot)
const itemId = mcData.getItemId(blockType)
if (itemId) {
const item = await import('prismarine-item')
const Item = item.default(mineflayer.bot.version)
await mineflayer.bot.creative.setInventorySlot(36, new Item(itemId, 1)) // 36 is first hotbar slot
}
block = mineflayer.bot.inventory.items().find(item => item.name.includes(blockType))
}
if (!block) {
logger.log(`Don't have any ${blockType} to place.`)
throw new ActionError('ITEM_NOT_FOUND', `Don't have any ${blockType} to place`, { item: blockType })
}
const targetBlock = mineflayer.bot.blockAt(targetDest)
if (!targetBlock) {
logger.log(`No block found at ${targetDest}.`)
throw new ActionError('TARGET_NOT_FOUND', `No block found at ${targetDest}`, { position: targetDest })
}
if (targetBlock.name === blockType) {
logger.log(`${blockType} already at ${targetBlock.position}.`)
throw new ActionError('PLACEMENT_FAILED', `${blockType} already at ${targetBlock.position}`, { blockType, position: targetBlock.position })
}
const emptyBlocks = [
'air',
'water',
'lava',
'grass',
'tall_grass',
'snow',
'dead_bush',
'fern',
]
if (!emptyBlocks.includes(targetBlock.name)) {View on GitHub (pinned to 27111382b4)
Solutions
- Ensure the chunk is loaded before placing: move the bot near the target or wait a tick after teleport.
- Validate the y coordinate is within the world height for the version (e.g. -64..320 for 1.18+).
- Confirm dimension matches; blockAt cannot resolve cross-dimensional coordinates.
- Catch ActionError and retry after the chunk loads.
Example fix
// before await placeBlock(bot, 'stone', x, y, z) // throws TARGET_NOT_FOUND if chunk unloaded // after await goToPosition(bot, x, y, z) await sleep(500) // let the chunk stream in if (bot.bot.blockAt(new Vec3(x, y, z))) await placeBlock(bot, 'stone', x, y, z)
Defensive patterns
Strategy: validation
Validate before calling
const dest = new Vec3(Math.floor(x), Math.floor(y), Math.floor(z))
const loaded = mineflayer.bot.blockAt(dest) !== null
if (!loaded) {
await goToPosition(mineflayer, x, y, z)
await sleep(500)
}
await placeBlock(mineflayer, blockType, x, y, z, placeOn) Type guard
const isChunkLoaded = (bot: Mineflayer, pos: Vec3): boolean => bot.bot.blockAt(pos) !== null
Try / catch
try {
await placeBlock(mineflayer, blockType, x, y, z, placeOn)
} catch (e) {
if (e instanceof ActionError && e.code === 'TARGET_NOT_FOUND') {
// move closer, wait for chunk, then retry
} else throw e
} Prevention
- Always path the bot near the target before placing to ensure the chunk is loaded.
- Validate y is within world height for the version before calling.
- After teleport, wait at least one tick for chunks to stream.
When it happens
Trigger: Call placeBlock at coordinates in an unloaded chunk, far outside the loaded render distance, or at y-values outside the world height limits. Coordinates are Math.floor-ed, so fractional input is not the cause.
Common situations: Bot teleported but the destination chunk has not streamed in yet, target is in a different dimension, target y is below 0 or above build height for the version, or the bot is moving fast and chunks lag behind.
Related errors
AI-assisted analysis of moeru-ai/airi@27111382b4 (2026-08-12).
Data as JSON: /api/errors/572fb3087c9cd081.
Report an issue: GitHub.