{"record":{"id":"6239f3003aa80f30","repo":"moeru-ai/airi","slug":"cannot-open-a-dualsense-controller-while-it-is-t","errorCode":null,"errorMessage":"Cannot open a DualSense controller while it is ${this.#lifecycle}.","messagePattern":"Cannot open a DualSense controller while it is (.+?)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/input-playstation-dualsense-5/src/controller.ts","lineNumber":64,"sourceCode":"  async open(): Promise<void> {\n    if (this.#lifecycle === 'open')\n      return\n    if (this.#lifecycle !== 'closed')\n      throw new Error(`Cannot open a DualSense controller while it is ${this.#lifecycle}.`)\n\n    this.#lifecycle = 'opening'\n    try {\n      if (!this.#device.opened)\n        await this.#device.open()\n      if (this.#connectionType === 'bluetooth')\n        await this.#device.receiveFeatureReport(0x05)\n      this.#device.addEventListener('inputreport', this.#handleInputReport)\n      this.#lifecycle = 'open'\n    }","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/moeru-ai/airi/blob/9c213115f8bd0fff9e6eabab02b077ac32da21be/packages/input-playstation-dualsense-5/src/controller.ts#L46-L82","documentation":"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.","triggerScenarios":"Thrown at packages/input-playstation-dualsense-5/src/controller.ts:64 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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."],"exampleFix":null,"handlingStrategy":"retry","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"}