moeru-ai/airi · error · AggregateError

The DualSense controller failed to open and close.

Error message

The DualSense controller failed to open and close.

What it means

Raised from open()'s catch block only when two failures stack: the device.open()/receiveFeatureReport(0x05) sequence failed (openError) AND the device was already marked opened, so the rollback attempted device.close() which also failed (closeError). The AggregateError carries both causes; the controller is reset to the 'closed' lifecycle and its inputreport listener removed before throwing. A failure where the device was never opened rethrows the original openError without wrapping.

Source

Thrown at packages/input-playstation-dualsense-5/src/controller.ts:85

    catch (openError) {
      this.#device.removeEventListener('inputreport', this.#handleInputReport)
      this.#lifecycle = 'closed'
      if (!this.#device.opened)
        throw openError

      try {
        await this.#device.close()
      }
      catch (closeError) {
        throw new AggregateError(
          [openError, closeError],
          'The DualSense controller failed to open and close.',
        )
      }
      throw openError
    }

View on GitHub (pinned to 9c213115f8)

Solutions

  1. Inspect `error.errors[0]` for the original open failure (e.g. SecurityError from missing WebHID permission) and `error.errors[1]` for the close failure.
  2. Recover by discarding the DualSenseController instance and constructing a fresh one from the HIDDevice after permissions are fixed.
  3. Log both nested errors; the close failure usually means the OS-level HID handle is wedged and may require replugging the controller.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at packages/input-playstation-dualsense-5/src/controller.ts:85 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/4f925ab24127416f. Report an issue: GitHub.