{"record":{"id":"ce3e1d0a4ce5d0c7","repo":"moeru-ai/airi","slug":"webhid-is-not-available-in-this-browser","errorCode":null,"errorMessage":"WebHID is not available in this browser.","messagePattern":"WebHID is not available in this browser\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/input-playstation-dualsense-5/src/web-hid.ts","lineNumber":121,"sourceCode":"function resolveWebHid(hid: HID | undefined): HID {\n  if (hid)\n    return hid\n  if (!isWebHidSupported())\n    throw new Error('WebHID is not available in this browser.')\n  return navigator.hid\n}","sourceCodeStart":103,"sourceCodeEnd":124,"githubUrl":"https://github.com/moeru-ai/airi/blob/9c213115f8bd0fff9e6eabab02b077ac32da21be/packages/input-playstation-dualsense-5/src/web-hid.ts#L103-L124","documentation":"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.","triggerScenarios":"Thrown at packages/input-playstation-dualsense-5/src/web-hid.ts:121 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Feature-detect with isWebHidSupported() (or `'hid' in navigator`) before offering DualSense features and show a fallback message.","Serve the app over HTTPS/localhost — WebHID requires a secure context in Chromium browsers.","Switch to the Gamepad API path (packages/input-gamepad) when WebHID is unavailable; standard gamepad polling needs no WebHID.","For tests or non-browser runtimes, inject a HID implementation so resolveWebHid returns it without touching navigator."],"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-14T00:17:10.932Z"}