{"record":{"id":"9b643aeb0d5cdc0d","repo":"microsoft/playwright","slug":"device-is-closed","errorCode":null,"errorMessage":"Device is closed","messagePattern":"Device is closed","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/playwright-core/src/server/android/android.ts","lineNumber":249,"sourceCode":"  }\n\n  async send(progress: Progress, method: string, params: any = {}): Promise<any> {\n    return await progress.race(this._send(method, params));\n  }\n\n  private async _send(method: string, params: any = {}): Promise<any> {\n    params = {\n      ...params,\n      // Patch the timeout in, just in case it's missing in one of the commands.\n      timeout: params.timeout || 0,\n    };\n    if (params.androidSelector) {\n      params.selector = params.androidSelector;\n      delete params.androidSelector;\n    }\n    const driver = await this._driver();\n    if (!driver || this._isClosed)\n      throw new Error('Device is closed');\n    const id = ++this._lastId;\n    const result = new Promise((fulfill, reject) => this._callbacks.set(id, { fulfill, reject }));\n    driver.send(JSON.stringify({ id, method, params }));\n    return result;\n  }\n\n  async close(progress: Progress) {\n    await progress.race(this._close());\n  }\n\n  private async _close() {\n    if (this._isClosed)\n      return;\n    this._isClosed = true;\n    if (this._pollingWebViews)\n      clearTimeout(this._pollingWebViews);\n    for (const connection of this._browserConnections)\n      await connection.close();","sourceCodeStart":231,"sourceCodeEnd":267,"githubUrl":"https://github.com/microsoft/playwright/blob/c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6/packages/playwright-core/src/server/android/android.ts#L231-L267","documentation":"Error \"Device is closed\" thrown in microsoft/playwright.","triggerScenarios":"Thrown at packages/playwright-core/src/server/android/android.ts:249 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6","analyzedAt":"2026-08-12T07:26:36.950Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}