moeru-ai/airi · warning · Error

no player name specified

Error message

no player name specified

What it means

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.

Source

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

import type { MineflayerPlugin } from '../libs/mineflayer/plugin'

import pathfinderModel from 'mineflayer-pathfinder'

import { useLogger } from '../utils/logger'

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. Provide the target name with the command: 'come Steve'.
  2. Ensure the command context populates sender when invoked programmatically.
  3. Return a usage hint instead of throwing for a smoother UX.

Example fix

// before
//   if (!username) { throw new Error('no player name specified') }
//
// after
//   if (!username) { logger.log('Usage: come <player>'); return }
Defensive patterns

Strategy: validation

Validate before calling

// Validate sender before resolving the come target:
// const username = commandCtx.command?.sender
// if (!username) { logger.log('Usage: come <player>'); return }

Type guard

function hasComeSender(ctx: unknown): ctx is { command: { sender: string } } {
  return !!ctx && typeof ctx === 'object'
    && !!(ctx as any).command && typeof (ctx as any).command.sender === 'string'
}

Prevention

When it happens

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

Common situations: User types 'come' instead of 'come Steve'; refactor of the command context that dropped sender; invoking handleCome from non-command code paths.

Related errors


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