{"record":{"id":"0cd84d675ebd23d2","repo":"microsoft/playwright","slug":"launching-server-is-not-supported","errorCode":null,"errorMessage":"Launching server is not supported","messagePattern":"Launching server is not supported","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/playwright-core/src/client/android.ts","lineNumber":66,"sourceCode":"  }\n\n  constructor(parent: ChannelOwner, type: string, guid: string, initializer: channels.AndroidInitializer) {\n    super(parent, type, guid, initializer);\n    this._timeoutSettings = new TimeoutSettings();\n  }\n\n  setDefaultTimeout(timeout: number) {\n    this._timeoutSettings.setDefaultTimeout(timeout);\n  }\n\n  async devices(options: { port?: number } = {}): Promise<AndroidDevice[]> {\n    const { devices } = await this._channel.devices(options, kNoTimeout);\n    return devices.map(d => AndroidDevice.from(d));\n  }\n\n  async launchServer(options: types.LaunchServerOptions = {}): Promise<api.BrowserServer> {\n    if (!this._serverLauncher)\n      throw new Error('Launching server is not supported');\n    return await this._serverLauncher.launchServer(options);\n  }\n\n  async connect(endpoint: string, options: Parameters<api.Android['connect']>[1] = {}): Promise<api.AndroidDevice> {\n    return await this._wrapApiCall(async () => {\n      const deadline = options.timeout ? monotonicTime() + options.timeout : 0;\n      const headers = { 'x-playwright-browser': 'android', ...options.headers };\n      const connectParams: channels.LocalUtilsConnectParams = { endpoint, headers, slowMo: options.slowMo };\n      const connection = await connectToEndpoint(this._connection, connectParams, { signal: undefined, timeout: options.timeout || 0 });\n\n      let device: AndroidDevice;\n      connection.on('close', () => {\n        device?._didClose();\n      });\n\n      const result = await raceAgainstDeadline(async () => {\n        const playwright = await connection!.initializePlaywright();\n        if (!playwright._initializer.preConnectedAndroidDevice) {","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/microsoft/playwright/blob/c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6/packages/playwright-core/src/client/android.ts#L48-L84","documentation":"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.","triggerScenarios":"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.","commonSituations":"Copying a BrowserType.launchServer pattern onto the Android object, or generically iterating over Playwright entry points and calling launchServer on each.","solutions":["Do not call launchServer on the Android object; it is unsupported.","Use BrowserType.launchServer on chromium/firefox/webkit to start a WS server.","If you need remote Android, drive it from a host that runs the Android driver and connect via android.connect()."],"exampleFix":"// before\nconst android = (playwright as any)._android;\nawait android.launchServer({ port: 0 });\n// after\nconst browser = await playwright.chromium.launchServer({ port: 0 });","handlingStrategy":"type-guard","validationCode":"if (!('_serverLauncher' in android) || !(android as any)._serverLauncher)\n  throw new Error('Android does not support launchServer; use a BrowserType instead.');","typeGuard":"function supportsLaunchServer(obj: any): boolean {\n  return !!obj?._serverLauncher;\n}","tryCatchPattern":null,"preventionTips":["Never mirror BrowserType.launchServer patterns onto the Android object.","Read the API surface per entry point before copying patterns."],"tags":["android","launch-server","unsupported"],"backgroundTag":null,"analyzedSha":"c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6","analyzedAt":"2026-08-12T07:26:36.950Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}