moeru-ai/airi · error · ActionError

TARGET_NOT_FOUND

TARGET_NOT_FOUND

Error message

No block found at ${pos}

What it means

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 }.

Source

Thrown at integrations/minecraft/src/cognitive/action/llm-actions.ts:292

  {
    name: 'mineBlockAt',
    description: 'Mine (break) a block at a specific position. Do NOT use this for regular resource collection. Use collectBlocks instead.',
    execution: 'async',
    // NOTICE: detach auto-follow before mining (same reason as collectBlocks) so the follow reflex
    // cannot interrupt bot.dig mid-break.
    followControl: 'detach',
    schema: z.object({
      x: z.number().describe('The x coordinate.'),
      y: z.number().describe('The y coordinate.'),
      z: z.number().describe('The z coordinate.'),
      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.'),
    }),
    perform: mineflayer => async (x: number, y: number, z: number, expected_block_type?: string) => {
      const pos = new Vec3(Math.floor(x), Math.floor(y), Math.floor(z))
      if (expected_block_type) {
        const block = mineflayer.bot.blockAt(pos)
        if (!block) {
          throw new ActionError('TARGET_NOT_FOUND', `No block found at ${pos}`, { position: pos })
        }

        if (!matchesBlockAlias(expected_block_type, block.name)) {
          throw new ActionError('UNKNOWN', `Block type mismatch at ${pos}: expected ${expected_block_type}, got ${block.name}`, {
            position: pos,
            expected: expected_block_type,
            actual: block.name,
          })
        }
      }

      await breakBlockAt(mineflayer, pos.x, pos.y, pos.z)
      return `Mined block at (${pos.x}, ${pos.y}, ${pos.z})`
    },
  },
  {
    name: 'craftRecipe',
    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.',

View on GitHub (pinned to 27111382b4)

Solutions

  1. Move the bot near the target coordinates first so the chunk loads, then retry mineBlockAt.
  2. Verify the position is within loaded render distance before issuing the mine action.
  3. If expected_block_type is not required, omit it — the guard only runs when it is supplied.
Defensive patterns

Strategy: validation

Validate before calling

function isChunkLoaded(bot, x, y, z) {
  const block = bot.blockAt(new Vec3(Math.floor(x), Math.floor(y), Math.floor(z)))
  return Boolean(block)
}
if (expected_block_type && !isChunkLoaded(bot, x, y, z))
  // navigate closer first

Type guard

function blockResolvable(bot, x, y, z) {
  return Boolean(bot.blockAt(new Vec3(Math.floor(x), Math.floor(y), Math.floor(z))))
}

Try / catch

try {
  await performAction({ tool: 'mineBlockAt', params: { x, y, z, expected_block_type } })
} catch (e) {
  if (e.code === 'TARGET_NOT_FOUND')
    // move bot near the coordinates so the chunk loads, then retry
  throw e
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of moeru-ai/airi@27111382b4 (2026-08-12). Data as JSON: /api/errors/828929cbcc74285d. Report an issue: GitHub.