moeru-ai/airi · warning · Error

can't find player ${username}, maybe they're too far away?

Error message

can't find player ${username}, maybe they're too far away?

What it means

Thrown by handleCome in the PathFinder plugin after the player name is resolved but bot.bot.players[username]?.entity is undefined. This means the player exists in the player list but has no loaded entity — typically because they are outside the bot's render/tracking distance, in another dimension, or their entity data has not yet arrived. The message suggests distance as the likely cause.

Source

Thrown at integrations/minecraft/src/plugins/pathfinder.ts:26

const { goals, Movements } = pathfinderModel

export function PathFinder(options?: { rangeGoal: number }): MineflayerPlugin {
  return {
    created(bot) {
      const logger = useLogger()

      let defaultMove: any

      const handleCome = (commandCtx: Context) => {
        const username = commandCtx.command!.sender
        if (!username) {
          throw new Error('no player name specified')
        }

        logger.withFields({ username }).log('Come command received')
        const target = bot.bot.players[username]?.entity
        if (!target) {
          throw new Error(`can't find player ${username}, maybe they're too far away?`)
        }

        const { x: playerX, y: playerY, z: playerZ } = target.position

        bot.bot.pathfinder.setMovements(defaultMove)
        bot.bot.pathfinder.setGoal(new goals.GoalNear(playerX, playerY, playerZ, options?.rangeGoal ?? 1))
      }

      defaultMove = new Movements(bot.bot)
      bot.onCommand('come', handleCome)
    },
  }
}

View on GitHub (pinned to 27111382b4)

Solutions

  1. Move closer to the target player first, or have them move closer to you.
  2. Confirm both players are in the same dimension.
  3. Retry after a short delay if the player just changed location.
  4. Guard with a presence check and emit a friendly message instead of throwing.

Example fix

// before
//   const target = bot.bot.players[username]?.entity
//   if (!target) { throw new Error(`can't find player ${username}, maybe they're too far away?`) }
//
// after
//   const target = bot.bot.players[username]?.entity
//   if (!target) { logger.log(`${username} is out of range or in another dimension`); return }
Defensive patterns

Strategy: validation

Validate before calling

// Confirm the entity is loaded before pathing:
// const target = bot.bot.players[username]?.entity
// if (!target) { logger.log(`${username} out of range or in another dimension`); return }

Type guard

function isEntityLoaded(p: unknown): p is { entity: { position: { x: number, y: number, z: number } } } {
  const e = (p as any)?.entity
  return !!e && typeof e.position?.x === 'number'
}

Prevention

When it happens

Trigger: The named player is logged in but too far away for the server to send entity updates; the player is in another dimension; the player just joined and entity data has not propagated; the player is in vanish/spectator and entity is withheld.

Common situations: come command targeting a far-away player; cross-dimensional come attempts; server view-distance too small for the gap; targeting a vanished/admin player.

Related errors


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