moeru-ai/airi · error · Error

The gamepad does not use the standard mapping.

Error message

The gamepad does not use the standard mapping.

What it means

createStandardGamepadSnapshot only knows how to normalize controllers that report the W3C 'standard' mapping; button and axis indexes have guaranteed positions only under that layout. The guard throws when the passed Gamepad reports any other mapping (e.g. a non-standard layout driver or an empty mapping), because applying standard positional indexes to it would produce wrong button/axis data.

Source

Thrown at packages/input-gamepad/src/standard-gamepad.ts:119

export function createStandardGamepadSnapshot(
  gamepad: Gamepad,
  options?: StandardGamepadSnapshotOptions,
): StandardGamepadSnapshot {
  if (gamepad.mapping !== 'standard')
    throw new Error('The gamepad does not use the standard mapping.')

  const deadzone = options?.deadzone ?? 0.12
  if (!Number.isFinite(deadzone) || deadzone < 0 || deadzone >= 1)
    throw new Error('The gamepad deadzone must be from 0 to less than 1.')

  return {
    buttons: createButtonStates(gamepad.buttons),
    family: detectGamepadFamily(gamepad.id),
    id: gamepad.id,
    index: gamepad.index,
    leftStick: applyRadialDeadzone(gamepad.axes[0] ?? 0, gamepad.axes[1] ?? 0, deadzone),
    rightStick: applyRadialDeadzone(gamepad.axes[2] ?? 0, gamepad.axes[3] ?? 0, deadzone),
    timestamp: gamepad.timestamp,
  }
}

View on GitHub (pinned to 9c213115f8)

Solutions

  1. Only pass Gamepad objects whose `mapping` property equals 'standard', or filter with `navigator.getGamepads().filter(g => g?.mapping === 'standard')` first.
  2. If you must support non-standard controllers, extend the package with a mapping-specific snapshot builder instead of forcing the standard one.
  3. In UI code, skip or grey out devices without the standard mapping and surface the reason to the user.
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at packages/input-gamepad/src/standard-gamepad.ts:119 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of moeru-ai/airi@9c213115f8 (2026-09-02). Data as JSON: /api/errors/bf78beb875c5b2f8. Report an issue: GitHub.