{"record":{"id":"1f99cb27eef1cfbf","repo":"moeru-ai/airi","slug":"can-t-find-player-username-maybe-they-re-too-f","errorCode":null,"errorMessage":"can't find player ${username}, maybe they're too far away?","messagePattern":"can't find player (.+?), maybe they're too far away\\?","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"integrations/minecraft/src/plugins/pathfinder.ts","lineNumber":26,"sourceCode":"const { goals, Movements } = pathfinderModel\n\nexport function PathFinder(options?: { rangeGoal: number }): MineflayerPlugin {\n  return {\n    created(bot) {\n      const logger = useLogger()\n\n      let defaultMove: any\n\n      const handleCome = (commandCtx: Context) => {\n        const username = commandCtx.command!.sender\n        if (!username) {\n          throw new Error('no player name specified')\n        }\n\n        logger.withFields({ username }).log('Come command received')\n        const target = bot.bot.players[username]?.entity\n        if (!target) {\n          throw new Error(`can't find player ${username}, maybe they're too far away?`)\n        }\n\n        const { x: playerX, y: playerY, z: playerZ } = target.position\n\n        bot.bot.pathfinder.setMovements(defaultMove)\n        bot.bot.pathfinder.setGoal(new goals.GoalNear(playerX, playerY, playerZ, options?.rangeGoal ?? 1))\n      }\n\n      defaultMove = new Movements(bot.bot)\n      bot.onCommand('come', handleCome)\n    },\n  }\n}\n","sourceCodeStart":8,"sourceCodeEnd":40,"githubUrl":"https://github.com/moeru-ai/airi/blob/27111382b4a79a7e983289d6e983a06af185ed0f/integrations/minecraft/src/plugins/pathfinder.ts#L8-L40","documentation":"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.","triggerScenarios":"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.","commonSituations":"come command targeting a far-away player; cross-dimensional come attempts; server view-distance too small for the gap; targeting a vanished/admin player.","solutions":["Move closer to the target player first, or have them move closer to you.","Confirm both players are in the same dimension.","Retry after a short delay if the player just changed location.","Guard with a presence check and emit a friendly message instead of throwing."],"exampleFix":"// before\n//   const target = bot.bot.players[username]?.entity\n//   if (!target) { throw new Error(`can't find player ${username}, maybe they're too far away?`) }\n//\n// after\n//   const target = bot.bot.players[username]?.entity\n//   if (!target) { logger.log(`${username} is out of range or in another dimension`); return }","handlingStrategy":"validation","validationCode":"// Confirm the entity is loaded before pathing:\n// const target = bot.bot.players[username]?.entity\n// if (!target) { logger.log(`${username} out of range or in another dimension`); return }","typeGuard":"function isEntityLoaded(p: unknown): p is { entity: { position: { x: number, y: number, z: number } } } {\n  const e = (p as any)?.entity\n  return !!e && typeof e.position?.x === 'number'\n}","tryCatchPattern":null,"preventionTips":["Confirm both players are in the same dimension before 'come'.","Move closer or have the target approach if out of render distance.","Retry shortly after dimension changes or teleports.","Log a friendly message instead of throwing when the entity is absent."],"tags":["minecraft","pathfinder-plugin","player-entity","render-distance"],"backgroundTag":null,"analyzedSha":"27111382b4a79a7e983289d6e983a06af185ed0f","analyzedAt":"2026-08-12T18:33:34.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}