microsoft/playwright · error · Error

Launching server is not supported

Error message

Launching server is not supported

What it means

Thrown by Android.launchServer() when the Android instance has no _serverLauncher. The Android driver does not ship a server launcher (unlike desktop BrowserTypes), so launching a server-side Android endpoint is not supported. The optional _serverLauncher field is left undefined for Android builds.

Source

Thrown at packages/playwright-core/src/client/android.ts:66

  }

  constructor(parent: ChannelOwner, type: string, guid: string, initializer: channels.AndroidInitializer) {
    super(parent, type, guid, initializer);
    this._timeoutSettings = new TimeoutSettings();
  }

  setDefaultTimeout(timeout: number) {
    this._timeoutSettings.setDefaultTimeout(timeout);
  }

  async devices(options: { port?: number } = {}): Promise<AndroidDevice[]> {
    const { devices } = await this._channel.devices(options, kNoTimeout);
    return devices.map(d => AndroidDevice.from(d));
  }

  async launchServer(options: types.LaunchServerOptions = {}): Promise<api.BrowserServer> {
    if (!this._serverLauncher)
      throw new Error('Launching server is not supported');
    return await this._serverLauncher.launchServer(options);
  }

  async connect(endpoint: string, options: Parameters<api.Android['connect']>[1] = {}): Promise<api.AndroidDevice> {
    return await this._wrapApiCall(async () => {
      const deadline = options.timeout ? monotonicTime() + options.timeout : 0;
      const headers = { 'x-playwright-browser': 'android', ...options.headers };
      const connectParams: channels.LocalUtilsConnectParams = { endpoint, headers, slowMo: options.slowMo };
      const connection = await connectToEndpoint(this._connection, connectParams, { signal: undefined, timeout: options.timeout || 0 });

      let device: AndroidDevice;
      connection.on('close', () => {
        device?._didClose();
      });

      const result = await raceAgainstDeadline(async () => {
        const playwright = await connection!.initializePlaywright();
        if (!playwright._initializer.preConnectedAndroidDevice) {

View on GitHub (pinned to c8fc3bf8d3)

Solutions

  1. Do not call launchServer on the Android object; it is unsupported.
  2. Use BrowserType.launchServer on chromium/firefox/webkit to start a WS server.
  3. If you need remote Android, drive it from a host that runs the Android driver and connect via android.connect().

Example fix

// before
const android = (playwright as any)._android;
await android.launchServer({ port: 0 });
// after
const browser = await playwright.chromium.launchServer({ port: 0 });
Defensive patterns

Strategy: type-guard

Validate before calling

if (!('_serverLauncher' in android) || !(android as any)._serverLauncher)
  throw new Error('Android does not support launchServer; use a BrowserType instead.');

Type guard

function supportsLaunchServer(obj: any): boolean {
  return !!obj?._serverLauncher;
}

Prevention

When it happens

Trigger: Calling `const android = playwright._android; await android.launchServer(...)` on a standard Playwright build. The check `!this._serverLauncher` is true for Android in all normal distributions.

Common situations: Copying a BrowserType.launchServer pattern onto the Android object, or generically iterating over Playwright entry points and calling launchServer on each.

Related errors


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