microsoft/playwright · error · Error

No devices found

Error message

No devices found

What it means

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.

Source

Thrown at packages/playwright-core/src/androidServerImpl.ts:39

import { createPlaywright } from './server/playwright';
import { nullProgress, ProgressController } from './server/progress';

import type { BrowserServer } from './client/browserType';
import type { LaunchAndroidServerOptions } from './client/types';

export class AndroidServerLauncherImpl {
  async launchServer(options: LaunchAndroidServerOptions = {}): Promise<BrowserServer> {
    const playwright = createPlaywright({ sdkLanguage: 'javascript', isServer: true });
    // 1. Pre-connect to the device
    const controller = new ProgressController();
    let devices = await controller.run(progress => playwright.android.devices(progress, {
      host: options.adbHost,
      port: options.adbPort,
      omitDriverInstall: options.omitDriverInstall,
    }));

    if (devices.length === 0)
      throw new Error('No devices found');

    if (options.deviceSerialNumber) {
      devices = devices.filter(d => d.serial === options.deviceSerialNumber);
      if (devices.length === 0)
        throw new Error(`No device with serial number '${options.deviceSerialNumber}' was found`);
    }

    if (devices.length > 1)
      throw new Error(`More than one device found. Please specify deviceSerialNumber`);

    const device = devices[0];

    const path = options.wsPath ? (options.wsPath.startsWith('/') ? options.wsPath : `/${options.wsPath}`) : `/${createGuid()}`;

    // 2. Start the server
    const server = new PlaywrightServer({ mode: 'launchServer', path, maxConnections: 1, preLaunchedAndroidDevice: device });
    const wsEndpoint = await server.listen(options.port, options.host);

View on GitHub (pinned to c8fc3bf8d3)

Solutions

  1. Run `adb devices` and confirm at least one device is listed and authorized.
  2. Start an emulator (`avdmanager`/`emulator`) or connect a physical device with USB debugging on.
  3. Restart the ADB server (`adb kill-server && adb start-server`).
  4. Verify adbHost/adbPort options match the ADB server endpoint.

Example fix

# before
$ adb devices  # empty list
$ node launch-android.js

# after
$ adb start-server
$ emulator -avd Pixel_API_33 &
$ adb wait-for-device
$ node launch-android.js
Defensive patterns

Strategy: validation

Validate before calling

import { execSync } from 'child_process';
function assertAndroidDevicePresent() {
  const out = execSync('adb devices', { encoding: 'utf8' });
  const count = out.split('\n').filter(l => /\bdevice\b/.test(l) && !/List of devices/.test(l)).length;
  if (count === 0) throw new Error('No attached Android devices; start an emulator or connect via adb');
}

Type guard

async function hasAndroidDevice(): Promise<boolean> {
  const devices = await playwright.android.devices(new ProgressController().progress);
  return devices.length > 0;
}

Try / catch

try {
  return await android.launchServer(options);
} catch (e) {
  if (/No devices found/.test(e.message)) {
    console.error('Run `adb devices` and ensure a device is attached and authorized.');
    process.exit(4);
  }
  throw e;
}

Prevention

When it happens

Trigger: 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`.

Common situations: 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.

Related errors


AI-assisted analysis of microsoft/playwright@c8fc3bf8d3 (2026-08-12). Data as JSON: /api/errors/c37ae587abe1f01e. Report an issue: GitHub.