{"record":{"id":"c37ae587abe1f01e","repo":"microsoft/playwright","slug":"no-devices-found","errorCode":null,"errorMessage":"No devices found","messagePattern":"No devices found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/playwright-core/src/androidServerImpl.ts","lineNumber":39,"sourceCode":"import { createPlaywright } from './server/playwright';\nimport { nullProgress, ProgressController } from './server/progress';\n\nimport type { BrowserServer } from './client/browserType';\nimport type { LaunchAndroidServerOptions } from './client/types';\n\nexport class AndroidServerLauncherImpl {\n  async launchServer(options: LaunchAndroidServerOptions = {}): Promise<BrowserServer> {\n    const playwright = createPlaywright({ sdkLanguage: 'javascript', isServer: true });\n    // 1. Pre-connect to the device\n    const controller = new ProgressController();\n    let devices = await controller.run(progress => playwright.android.devices(progress, {\n      host: options.adbHost,\n      port: options.adbPort,\n      omitDriverInstall: options.omitDriverInstall,\n    }));\n\n    if (devices.length === 0)\n      throw new Error('No devices found');\n\n    if (options.deviceSerialNumber) {\n      devices = devices.filter(d => d.serial === options.deviceSerialNumber);\n      if (devices.length === 0)\n        throw new Error(`No device with serial number '${options.deviceSerialNumber}' was found`);\n    }\n\n    if (devices.length > 1)\n      throw new Error(`More than one device found. Please specify deviceSerialNumber`);\n\n    const device = devices[0];\n\n    const path = options.wsPath ? (options.wsPath.startsWith('/') ? options.wsPath : `/${options.wsPath}`) : `/${createGuid()}`;\n\n    // 2. Start the server\n    const server = new PlaywrightServer({ mode: 'launchServer', path, maxConnections: 1, preLaunchedAndroidDevice: device });\n    const wsEndpoint = await server.listen(options.port, options.host);\n","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/microsoft/playwright/blob/c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6/packages/playwright-core/src/androidServerImpl.ts#L21-L57","documentation":"Thrown by AndroidServerLauncherImpl.launchServer when `playwright.android.devices(...)` returns an empty list — no Android devices are reachable via the configured ADB host/port. It is a pre-flight check before any server socket is opened.","triggerScenarios":"Calling `android.launchServer({})` (or the `playwright launch-server --android` equivalent) when no device is attached, ADB is not running, or the adbHost/adbPort point at an unreachable ADB server. The check is `if (devices.length === 0) throw`.","commonSituations":"Emulator not started; USB debugging disabled on the device; ADB server down; wrong adbHost/adbPort; device disconnected mid-launch; CI runner without an Android emulator.","solutions":["Run `adb devices` and confirm at least one device is listed and authorized.","Start an emulator (`avdmanager`/`emulator`) or connect a physical device with USB debugging on.","Restart the ADB server (`adb kill-server && adb start-server`).","Verify adbHost/adbPort options match the ADB server endpoint."],"exampleFix":"# before\n$ adb devices  # empty list\n$ node launch-android.js\n\n# after\n$ adb start-server\n$ emulator -avd Pixel_API_33 &\n$ adb wait-for-device\n$ node launch-android.js","handlingStrategy":"validation","validationCode":"import { execSync } from 'child_process';\nfunction assertAndroidDevicePresent() {\n  const out = execSync('adb devices', { encoding: 'utf8' });\n  const count = out.split('\\n').filter(l => /\\bdevice\\b/.test(l) && !/List of devices/.test(l)).length;\n  if (count === 0) throw new Error('No attached Android devices; start an emulator or connect via adb');\n}","typeGuard":"async function hasAndroidDevice(): Promise<boolean> {\n  const devices = await playwright.android.devices(new ProgressController().progress);\n  return devices.length > 0;\n}","tryCatchPattern":"try {\n  return await android.launchServer(options);\n} catch (e) {\n  if (/No devices found/.test(e.message)) {\n    console.error('Run `adb devices` and ensure a device is attached and authorized.');\n    process.exit(4);\n  }\n  throw e;\n}","preventionTips":["Run `adb devices` as a preflight in CI.","Boot the emulator and `adb wait-for-device` before launching.","Confirm USB debugging is authorized on physical devices."],"tags":["android","adb","launch-server","environment"],"backgroundTag":null,"analyzedSha":"c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6","analyzedAt":"2026-08-12T07:26:36.950Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}