{"record":{"id":"996def63eb8779dd","repo":"moeru-ai/airi","slug":"no-player-name-specified","errorCode":null,"errorMessage":"no player name specified","messagePattern":"no player name specified","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"integrations/minecraft/src/plugins/pathfinder.ts","lineNumber":20,"sourceCode":"import type { MineflayerPlugin } from '../libs/mineflayer/plugin'\n\nimport pathfinderModel from 'mineflayer-pathfinder'\n\nimport { useLogger } from '../utils/logger'\n\nconst { 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  }","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/moeru-ai/airi/blob/27111382b4a79a7e983289d6e983a06af185ed0f/integrations/minecraft/src/plugins/pathfinder.ts#L2-L38","documentation":"Thrown by the 'come' command handler (handleCome) in the PathFinder plugin when commandCtx.command.sender is falsy. Identical in shape to the follow-plugin guard: the come command needs a player name to path toward, and without a sender it cannot resolve a target. Input validation at the command boundary.","triggerScenarios":"A player sends 'come' with no name and sender is not populated; programmatic invocation of handleCome with an empty context; command framework not attaching sender.","commonSituations":"User types 'come' instead of 'come Steve'; refactor of the command context that dropped sender; invoking handleCome from non-command code paths.","solutions":["Provide the target name with the command: 'come Steve'.","Ensure the command context populates sender when invoked programmatically.","Return a usage hint instead of throwing for a smoother UX."],"exampleFix":"// before\n//   if (!username) { throw new Error('no player name specified') }\n//\n// after\n//   if (!username) { logger.log('Usage: come <player>'); return }","handlingStrategy":"validation","validationCode":"// Validate sender before resolving the come target:\n// const username = commandCtx.command?.sender\n// if (!username) { logger.log('Usage: come <player>'); return }","typeGuard":"function hasComeSender(ctx: unknown): ctx is { command: { sender: string } } {\n  return !!ctx && typeof ctx === 'object'\n    && !!(ctx as any).command && typeof (ctx as any).command.sender === 'string'\n}","tryCatchPattern":null,"preventionTips":["Always pass a player name with 'come <name>'.","Return a usage hint instead of throwing when sender is missing.","Ensure programmatic invocations populate the command sender."],"tags":["minecraft","pathfinder-plugin","command-validation","missing-argument"],"backgroundTag":null,"analyzedSha":"27111382b4a79a7e983289d6e983a06af185ed0f","analyzedAt":"2026-08-12T18:33:34.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}