moeru-ai/airi · error · Error
Cannot open a DualSense controller while it is ${this.#lifec
Error message
Cannot open a DualSense controller while it is ${this.#lifecycle}. What it means
open() is only valid from the 'closed' lifecycle state. The guard throws when open() is called while the controller is in a transitional or busy state ('opening', 'closing'), meaning a previous open/close is still in flight and the HID device cannot safely start another open sequence. A repeat open while already 'open' returns silently and never reaches this error.
Source
Thrown at packages/input-playstation-dualsense-5/src/controller.ts:64
async open(): Promise<void> {
if (this.#lifecycle === 'open')
return
if (this.#lifecycle !== 'closed')
throw new Error(`Cannot open a DualSense controller while it is ${this.#lifecycle}.`)
this.#lifecycle = 'opening'
try {
if (!this.#device.opened)
await this.#device.open()
if (this.#connectionType === 'bluetooth')
await this.#device.receiveFeatureReport(0x05)
this.#device.addEventListener('inputreport', this.#handleInputReport)
this.#lifecycle = 'open'
}View on GitHub (pinned to 9c213115f8)
Solutions
- Await the in-flight open()/close() promise before calling open() again instead of issuing concurrent lifecycle calls.
- Track the open() promise in the caller and reuse it (memoize the promise rather than the result).
- Retry open() after the current transition completes; the error message names the current lifecycle state to make this diagnosable.
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at packages/input-playstation-dualsense-5/src/controller.ts:64 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/6239f3003aa80f30.
Report an issue: GitHub.