microsoft/playwright · error · Error

Already connected to the server

Error message

Already connected to the server

What it means

Error "Already connected to the server" thrown in microsoft/playwright.

Source

Thrown at packages/playwright-core/src/client/network.ts:555

        this._channel.closePage({ code, reason, wasClean }, kNoTimeout).catch(() => {});
    });
  }

  url() {
    return this._initializer.url;
  }

  protocols(): string[] {
    return [...this._initializer.protocols];
  }

  async close(options: { code?: number, reason?: string } = {}) {
    await this._channel.closePage({ ...options, wasClean: true }, kNoTimeout).catch(() => {});
  }

  connectToServer() {
    if (this._connected)
      throw new Error('Already connected to the server');
    this._connected = true;
    this._channel.connect({}, kNoTimeout).catch(() => {});
    return this._server;
  }

  send(message: string | Buffer) {
    if (isString(message))
      this._channel.sendToPage({ message, isBase64: false }, kNoTimeout).catch(() => {});
    else
      this._channel.sendToPage({ message: message.toString('base64'), isBase64: true }, kNoTimeout).catch(() => {});
  }

  onMessage(handler: (message: string | Buffer) => any) {
    this._onPageMessage = handler;
  }

  onClose(handler: (code: number | undefined, reason: string | undefined) => any) {
    this._onPageClose = handler;

View on GitHub (pinned to c8fc3bf8d3)

When it happens

Trigger: Thrown at packages/playwright-core/src/client/network.ts:555 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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