{"record":{"id":"828929cbcc74285d","repo":"moeru-ai/airi","slug":"target-not-found","errorCode":"TARGET_NOT_FOUND","errorMessage":"No block found at ${pos}","messagePattern":"No block found at (.+?)","errorType":"error_code","errorClass":"ActionError","httpStatus":null,"severity":"error","filePath":"integrations/minecraft/src/cognitive/action/llm-actions.ts","lineNumber":292,"sourceCode":"  {\n    name: 'mineBlockAt',\n    description: 'Mine (break) a block at a specific position. Do NOT use this for regular resource collection. Use collectBlocks instead.',\n    execution: 'async',\n    // NOTICE: detach auto-follow before mining (same reason as collectBlocks) so the follow reflex\n    // cannot interrupt bot.dig mid-break.\n    followControl: 'detach',\n    schema: z.object({\n      x: z.number().describe('The x coordinate.'),\n      y: z.number().describe('The y coordinate.'),\n      z: z.number().describe('The z coordinate.'),\n      expected_block_type: z.string().optional().describe('Optional: expected block type at the position (e.g. oak_log). If provided and mismatched, the action fails.'),\n    }),\n    perform: mineflayer => async (x: number, y: number, z: number, expected_block_type?: string) => {\n      const pos = new Vec3(Math.floor(x), Math.floor(y), Math.floor(z))\n      if (expected_block_type) {\n        const block = mineflayer.bot.blockAt(pos)\n        if (!block) {\n          throw new ActionError('TARGET_NOT_FOUND', `No block found at ${pos}`, { position: pos })\n        }\n\n        if (!matchesBlockAlias(expected_block_type, block.name)) {\n          throw new ActionError('UNKNOWN', `Block type mismatch at ${pos}: expected ${expected_block_type}, got ${block.name}`, {\n            position: pos,\n            expected: expected_block_type,\n            actual: block.name,\n          })\n        }\n      }\n\n      await breakBlockAt(mineflayer, pos.x, pos.y, pos.z)\n      return `Mined block at (${pos.x}, ${pos.y}, ${pos.z})`\n    },\n  },\n  {\n    name: 'craftRecipe',\n    description: 'Craft an item. Automatically finds or places a crafting table if needed, and handles intermediate materials for basic items (planks, sticks). Use recipePlan first to check required materials for complex items.',","sourceCodeStart":274,"sourceCodeEnd":310,"githubUrl":"https://github.com/moeru-ai/airi/blob/27111382b4a79a7e983289d6e983a06af185ed0f/integrations/minecraft/src/cognitive/action/llm-actions.ts#L274-L310","documentation":"Thrown by the mineBlockAt action (ActionError code TARGET_NOT_FOUND) when expected_block_type is supplied but mineflayer.bot.blockAt(pos) returns a falsy block. This means the chunk at the floored coordinates is not loaded, so the world has no block data to compare. Context carries { position }.","triggerScenarios":"Calling mineBlockAt with coordinates in an unloaded chunk; the bot moved away and the chunk unloaded; coordinates far outside loaded render distance; y-coordinate outside world bounds.","commonSituations":"LLM hallucinates coordinates it has not visited; player gives coordinates from a distant area not yet loaded; the bot teleported but chunks have not streamed in; y below 0 or above build limit in the current dimension.","solutions":["Move the bot near the target coordinates first so the chunk loads, then retry mineBlockAt.","Verify the position is within loaded render distance before issuing the mine action.","If expected_block_type is not required, omit it — the guard only runs when it is supplied."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"function isChunkLoaded(bot, x, y, z) {\n  const block = bot.blockAt(new Vec3(Math.floor(x), Math.floor(y), Math.floor(z)))\n  return Boolean(block)\n}\nif (expected_block_type && !isChunkLoaded(bot, x, y, z))\n  // navigate closer first","typeGuard":"function blockResolvable(bot, x, y, z) {\n  return Boolean(bot.blockAt(new Vec3(Math.floor(x), Math.floor(y), Math.floor(z))))\n}","tryCatchPattern":"try {\n  await performAction({ tool: 'mineBlockAt', params: { x, y, z, expected_block_type } })\n} catch (e) {\n  if (e.code === 'TARGET_NOT_FOUND')\n    // move bot near the coordinates so the chunk loads, then retry\n  throw e\n}","preventionTips":["Load the chunk (stand near it) before mining by coordinate with an expected type.","Omit expected_block_type when you do not need the safety check."],"tags":["minecraft","action","target","chunk","llm-actions"],"backgroundTag":null,"analyzedSha":"27111382b4a79a7e983289d6e983a06af185ed0f","analyzedAt":"2026-08-12T18:33:34.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}