{"record":{"id":"572fb3087c9cd081","repo":"moeru-ai/airi","slug":"target-not-found-572fb3","errorCode":"TARGET_NOT_FOUND","errorMessage":"No block found at ${targetDest}","messagePattern":"No block found at (.+?)","errorType":"exception","errorClass":"ActionError","httpStatus":null,"severity":"warning","filePath":"integrations/minecraft/src/skills/actions/world-interactions.ts","lineNumber":65,"sourceCode":"  if (!block && mineflayer.bot.game.gameMode === 'creative') {\n    const mcData = McData.fromBot(mineflayer.bot)\n    const itemId = mcData.getItemId(blockType)\n    if (itemId) {\n      const item = await import('prismarine-item')\n      const Item = item.default(mineflayer.bot.version)\n      await mineflayer.bot.creative.setInventorySlot(36, new Item(itemId, 1)) // 36 is first hotbar slot\n    }\n    block = mineflayer.bot.inventory.items().find(item => item.name.includes(blockType))\n  }\n  if (!block) {\n    logger.log(`Don't have any ${blockType} to place.`)\n    throw new ActionError('ITEM_NOT_FOUND', `Don't have any ${blockType} to place`, { item: blockType })\n  }\n\n  const targetBlock = mineflayer.bot.blockAt(targetDest)\n  if (!targetBlock) {\n    logger.log(`No block found at ${targetDest}.`)\n    throw new ActionError('TARGET_NOT_FOUND', `No block found at ${targetDest}`, { position: targetDest })\n  }\n\n  if (targetBlock.name === blockType) {\n    logger.log(`${blockType} already at ${targetBlock.position}.`)\n    throw new ActionError('PLACEMENT_FAILED', `${blockType} already at ${targetBlock.position}`, { blockType, position: targetBlock.position })\n  }\n\n  const emptyBlocks = [\n    'air',\n    'water',\n    'lava',\n    'grass',\n    'tall_grass',\n    'snow',\n    'dead_bush',\n    'fern',\n  ]\n  if (!emptyBlocks.includes(targetBlock.name)) {","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/moeru-ai/airi/blob/27111382b4a79a7e983289d6e983a06af185ed0f/integrations/minecraft/src/skills/actions/world-interactions.ts#L47-L83","documentation":"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 }.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nawait placeBlock(bot, 'stone', x, y, z) // throws TARGET_NOT_FOUND if chunk unloaded\n\n// after\nawait goToPosition(bot, x, y, z)\nawait sleep(500) // let the chunk stream in\nif (bot.bot.blockAt(new Vec3(x, y, z))) await placeBlock(bot, 'stone', x, y, z)","handlingStrategy":"validation","validationCode":"const dest = new Vec3(Math.floor(x), Math.floor(y), Math.floor(z))\nconst loaded = mineflayer.bot.blockAt(dest) !== null\nif (!loaded) {\n  await goToPosition(mineflayer, x, y, z)\n  await sleep(500)\n}\nawait placeBlock(mineflayer, blockType, x, y, z, placeOn)","typeGuard":"const isChunkLoaded = (bot: Mineflayer, pos: Vec3): boolean =>\n  bot.bot.blockAt(pos) !== null","tryCatchPattern":"try {\n  await placeBlock(mineflayer, blockType, x, y, z, placeOn)\n} catch (e) {\n  if (e instanceof ActionError && e.code === 'TARGET_NOT_FOUND') {\n    // move closer, wait for chunk, then retry\n  } else throw e\n}","preventionTips":["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."],"tags":["minecraft","target-not-found","chunk-loading","mineflayer"],"backgroundTag":null,"analyzedSha":"27111382b4a79a7e983289d6e983a06af185ed0f","analyzedAt":"2026-08-12T18:33:34.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}