moeru-ai/airi · error · Error

WebHID is not available in this browser.

Error message

WebHID is not available in this browser.

What it means

resolveWebHid is the package's single access point for the navigator.hid object. It first honors an explicitly injected HID instance (dependency injection for tests/embedded environments); otherwise it checks isWebHidSupported() and throws rather than dereferencing navigator.hid on a browser that lacks WebHID (or an insecure context where it is hidden), which would otherwise be an opaque TypeError. Callers: devices() and webHid() invoke it lazily at use time.

Source

Thrown at packages/input-playstation-dualsense-5/src/web-hid.ts:121

function resolveWebHid(hid: HID | undefined): HID {
  if (hid)
    return hid
  if (!isWebHidSupported())
    throw new Error('WebHID is not available in this browser.')
  return navigator.hid
}

View on GitHub (pinned to 9c213115f8)

Solutions

  1. Feature-detect with isWebHidSupported() (or `'hid' in navigator`) before offering DualSense features and show a fallback message.
  2. Serve the app over HTTPS/localhost — WebHID requires a secure context in Chromium browsers.
  3. Switch to the Gamepad API path (packages/input-gamepad) when WebHID is unavailable; standard gamepad polling needs no WebHID.
  4. For tests or non-browser runtimes, inject a HID implementation so resolveWebHid returns it without touching navigator.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at packages/input-playstation-dualsense-5/src/web-hid.ts:121 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/ce3e1d0a4ce5d0c7. Report an issue: GitHub.