microsoft/playwright · error · Error

Client is v${clientInfo.version}, session '${this.name}' is

Error message

Client is v${clientInfo.version}, session '${this.name}' is v${this.config.version}. Run

  playwright-cli${this.name !== 'default' ? ` -s=${this.name}` : ''} open

to restart the browser session.

What it means

Thrown by Session.run when isCompatible returns false, i.e. compareSemver(clientInfo.version, this.config.version) < 0 — the running client's version is OLDER than the version that started the daemon session. The session must be recreated by the newer client, so the error tells the user to run `playwright-cli open`.

Source

Thrown at packages/playwright-core/src/tools/cli-client/session.ts:47

export class Session {
  readonly name: string;
  readonly config: SessionConfig;
  private _sessionFile: SessionFile;

  constructor(sessionFile: SessionFile) {
    this.config = sessionFile.config;
    this.name = this.config.name;
    this._sessionFile = sessionFile;
  }

  isCompatible(clientInfo: ClientInfo): boolean {
    return compareSemver(clientInfo.version, this.config.version) >= 0;
  }

  async run(clientInfo: ClientInfo, args: MinimistArgs, options?: { raw?: boolean, json?: boolean }): Promise<{ text: string, isError?: boolean }> {
    if (!this.isCompatible(clientInfo))
      throw new Error(`Client is v${clientInfo.version}, session '${this.name}' is v${this.config.version}. Run\n\n  playwright-cli${this.name !== 'default' ? ` -s=${this.name}` : ''} open\n\nto restart the browser session.`);

    const { socket } = await this._connect();
    if (!socket)
      throw new Error(`Browser '${this.name}' is not open. Run\n\n  playwright-cli${this.name !== 'default' ? ` -s=${this.name}` : ''} open\n\nto start the browser session.`);
    return await SocketConnectionClient.sendAndClose(socket, 'run', { args, cwd: process.cwd(), raw: options?.raw, json: options?.json });
  }

  async stop(): Promise<{ wasOpen: boolean }> {
    if (!await this.canConnect())
      return { wasOpen: false };
    await this._stopDaemon();
    return { wasOpen: true };
  }

  async deleteData(): Promise<{ existed: boolean, deletedUserDataDir: boolean }> {
    await this.stop();

    const dataDirs = await fs.promises.readdir(this._sessionFile.daemonDir).catch(() => []);

View on GitHub (pinned to c8fc3bf8d3)

Solutions

  1. Run playwright-cli open (add -s=<name> if non-default) to restart the session with the current client version.
  2. Alternatively, upgrade the client back to >= the session's recorded version.
  3. Call session.stop() / playwright-cli -s=<name> close to remove the stale session before reopening.

Example fix

# before - client v1.2, session was started by v1.5
playwright-cli -s=ci screenshot   # throws

# after
playwright-cli -s=ci open           # restart session under v1.2
playwright-cli -s=ci screenshot
Defensive patterns

Strategy: validation

Validate before calling

import { compareSemver } from '../utils/socketConnection';
function isClientCompatible(clientVersion: string, sessionVersion: string): boolean {
  return compareSemver(clientVersion, sessionVersion) >= 0;
}
if (!isClientCompatible(clientInfo.version, session.config.version)) {
  // prompt user to run `playwright-cli open` instead of attempting run

Type guard

function isIncompatibleVersionError(e: unknown): boolean {
  return e instanceof Error && e.message.startsWith('Client is v');
}

Try / catch

try {
  await session.run(clientInfo, args);
} catch (e) {
  if (isIncompatibleVersionError(e)) {
    await Session.startDaemon(clientInfo, { session: session.name } as any, 'open');
    await session.run(clientInfo, args);
  } else throw e;
}

Prevention

When it happens

Trigger: Downgrading playwright-cli (or the MCP client) while an older daemon session is still running; client upgraded the session earlier, then reverted versions.

Common situations: Local dev switching branches/versions; CI caching an older build while a dev daemon from a newer build is still alive; mismatched global vs local installs.

Related errors


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