{"record":{"id":"6225df2b5ed9b709","repo":"moeru-ai/airi","slug":"the-gamepad-api-is-not-available-in-this-browser","errorCode":null,"errorMessage":"The Gamepad API is not available in this browser.","messagePattern":"The Gamepad API is not available in this browser\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/input-gamepad/src/standard-gamepad.ts","lineNumber":155,"sourceCode":"  constructor(options?: StandardGamepadMonitorOptions) {\n    this.#cancelFrame = options?.cancelFrame ?? (handle => cancelAnimationFrame(handle))\n    this.#deadzone = options?.deadzone\n    this.#getGamepads = options?.getGamepads ?? (() => {\n      if (!isGamepadApiSupported())\n        throw new Error('The Gamepad API is not available in this browser.')\n      return navigator.getGamepads()\n    })\n    this.#requestFrame = options?.requestFrame ?? (callback => requestAnimationFrame(callback))\n  }","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/moeru-ai/airi/blob/9c213115f8bd0fff9e6eabab02b077ac32da21be/packages/input-gamepad/src/standard-gamepad.ts#L137-L173","documentation":"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.","triggerScenarios":"Thrown at packages/input-gamepad/src/standard-gamepad.ts:155 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check isGamepadApiSupported() (or `'getGamepads' in navigator`) before constructing StandardGamepadMonitor and show a graceful 'gamepads not supported' UI instead.","Serve the page over HTTPS/localhost — the Gamepad API requires a secure context in most browsers.","Inject a custom `getGamepads` via StandardGamepadMonitorOptions when testing or running in an environment that emulates the API."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9c213115f8bd0fff9e6eabab02b077ac32da21be","analyzedAt":"2026-09-02T04:27:24.639Z","contentChangedAt":"2026-09-02T04:27:24.639Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}