moeru-ai/airi · error · ActionError

UNKNOWN

UNKNOWN

Error message

Block type mismatch at ${pos}: expected ${expected_block_type}, got ${block.name}

What it means

Thrown by the mineBlockAt action (ActionError code UNKNOWN) when expected_block_type is supplied, the block exists at pos, but matchesBlockAlias(expected_block_type, block.name) returns false. This is a deliberate safety check so the bot does not break the wrong block. Context carries { position, expected, actual }.

Source

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

    // 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.',
    execution: 'async',
    schema: z.object({
      recipe_name: z.string().describe('The name of the output item to craft.'),
      num: z.number().int().describe('The number of times to execute the recipe (craft count, NOT output item count). E.g. crafting planks once yields 4 planks, so num=2 yields 8 planks.').min(1),

View on GitHub (pinned to 27111382b4)

Solutions

  1. Re-scan the area to get fresh block names before retrying with corrected coordinates.
  2. Use a broader alias or the exact minecraft block name returned in 'actual' from the context.
  3. If the block was already removed, treat the task as complete rather than retrying.
  4. Omit expected_block_type to skip the check entirely when the position is trusted.
Defensive patterns

Strategy: try-catch

Validate before calling

const block = bot.blockAt(pos)
if (expected_block_type && block && !matchesBlockAlias(expected_block_type, block.name))
  // re-scan or correct expected_block_type before mining

Type guard

function blockMatchesExpectation(bot, pos, expected) {
  const block = bot.blockAt(pos)
  return !expected || !block || matchesBlockAlias(expected, block.name)
}

Try / catch

try {
  await performAction({ tool: 'mineBlockAt', params: { x, y, z, expected_block_type } })
} catch (e) {
  if (e.code === 'UNKNOWN' && e.context?.actual)
    // use e.context.actual as the corrected type or re-scan
  throw e
}

Prevention

When it happens

Trigger: The LLM/player expects 'oak_log' at a position but the actual block is 'oak_leaves' or 'air' (already mined); coordinates drifted or were rounded; the alias maps to a different family than the block present.

Common situations: The target was already mined by another player or creeper explosion; the LLM used stale coordinates from an earlier observation; alias normalization maps both directions but the actual block is genuinely different; floor() rounding landed on an adjacent block.

Related errors


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