moeru-ai/airi · error · Error

The Gamepad API is not available in this browser.

Error message

The Gamepad API is not available in this browser.

What it means

The default getGamepads implementation injected in the StandardGamepadMonitor constructor calls isGamepadApiSupported() before touching navigator.getGamepads(). Browsers without the Gamepad API (or insecure contexts where it is not exposed) have no navigator.getGamepads, so calling it would be a TypeError; this guard turns that into an explicit, diagnosable error raised the first time the monitor polls.

Source

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

  constructor(options?: StandardGamepadMonitorOptions) {
    this.#cancelFrame = options?.cancelFrame ?? (handle => cancelAnimationFrame(handle))
    this.#deadzone = options?.deadzone
    this.#getGamepads = options?.getGamepads ?? (() => {
      if (!isGamepadApiSupported())
        throw new Error('The Gamepad API is not available in this browser.')
      return navigator.getGamepads()
    })
    this.#requestFrame = options?.requestFrame ?? (callback => requestAnimationFrame(callback))
  }

View on GitHub (pinned to 9c213115f8)

Solutions

  1. Check isGamepadApiSupported() (or `'getGamepads' in navigator`) before constructing StandardGamepadMonitor and show a graceful 'gamepads not supported' UI instead.
  2. Serve the page over HTTPS/localhost — the Gamepad API requires a secure context in most browsers.
  3. Inject a custom `getGamepads` via StandardGamepadMonitorOptions when testing or running in an environment that emulates the API.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at packages/input-gamepad/src/standard-gamepad.ts:155 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/6225df2b5ed9b709. Report an issue: GitHub.