{"record":{"id":"9d4040fe44f686a2","repo":"moeru-ai/airi","slug":"open-the-dualsense-controller-before-you-send-an-o","errorCode":null,"errorMessage":"Open the DualSense controller before you send an output report.","messagePattern":"Open the DualSense controller before you send an output report\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/input-playstation-dualsense-5/src/controller.ts","lineNumber":121,"sourceCode":"  async sendOutput(output: DualSenseOutputState): Promise<void> {\n    if (this.#lifecycle !== 'open')\n      throw new Error('Open the DualSense controller before you send an output report.')\n\n    const report = buildDualSenseOutputReport(\n      this.#connectionType,\n      output,\n      this.#outputSequenceNumber,\n    )\n    this.#outputSequenceNumber = report.nextSequenceNumber\n    await this.#device.sendReport(report.reportId, report.data)\n  }","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/moeru-ai/airi/blob/9c213115f8bd0fff9e6eabab02b077ac32da21be/packages/input-playstation-dualsense-5/src/controller.ts#L103-L139","documentation":"sendOutput() builds a report and writes it to the HID device, which WebHID only allows while the device is open. The guard throws whenever the controller is not in the 'open' lifecycle state — never opened, already closed, or mid-transition — because sendReport on an unopened HIDDevice would reject with a lower-level error anyway; this makes the required ordering explicit at the API boundary.","triggerScenarios":"Thrown at packages/input-playstation-dualsense-5/src/controller.ts:121 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Call `await controller.open()` before the first sendOutput and keep the controller open for the session.","Gate output sending on `controller.lifecycle === 'open'` (the getter is public) or pause sending in response to close events.","If outputs fire from a timer, check lifecycle before each send or wrap the send loop in a guard that skips while not open."],"exampleFix":null,"handlingStrategy":"validation","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"}