{"record":{"id":"cfac6630b7100cb8","repo":"microsoft/playwright","slug":"client-is-v-clientinfo-version-session-this","errorCode":null,"errorMessage":"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.","messagePattern":"Client is v(.+?), session '(.+?)' is v(.+?)\\. Run\n\n  playwright-cli(.+?)` : ''\\} open\n\nto restart the browser session\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/playwright-core/src/tools/cli-client/session.ts","lineNumber":47,"sourceCode":"\nexport class Session {\n  readonly name: string;\n  readonly config: SessionConfig;\n  private _sessionFile: SessionFile;\n\n  constructor(sessionFile: SessionFile) {\n    this.config = sessionFile.config;\n    this.name = this.config.name;\n    this._sessionFile = sessionFile;\n  }\n\n  isCompatible(clientInfo: ClientInfo): boolean {\n    return compareSemver(clientInfo.version, this.config.version) >= 0;\n  }\n\n  async run(clientInfo: ClientInfo, args: MinimistArgs, options?: { raw?: boolean, json?: boolean }): Promise<{ text: string, isError?: boolean }> {\n    if (!this.isCompatible(clientInfo))\n      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.`);\n\n    const { socket } = await this._connect();\n    if (!socket)\n      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.`);\n    return await SocketConnectionClient.sendAndClose(socket, 'run', { args, cwd: process.cwd(), raw: options?.raw, json: options?.json });\n  }\n\n  async stop(): Promise<{ wasOpen: boolean }> {\n    if (!await this.canConnect())\n      return { wasOpen: false };\n    await this._stopDaemon();\n    return { wasOpen: true };\n  }\n\n  async deleteData(): Promise<{ existed: boolean, deletedUserDataDir: boolean }> {\n    await this.stop();\n\n    const dataDirs = await fs.promises.readdir(this._sessionFile.daemonDir).catch(() => []);","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/microsoft/playwright/blob/c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6/packages/playwright-core/src/tools/cli-client/session.ts#L29-L65","documentation":"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`.","triggerScenarios":"Downgrading playwright-cli (or the MCP client) while an older daemon session is still running; client upgraded the session earlier, then reverted versions.","commonSituations":"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.","solutions":["Run playwright-cli open (add -s=<name> if non-default) to restart the session with the current client version.","Alternatively, upgrade the client back to >= the session's recorded version.","Call session.stop() / playwright-cli -s=<name> close to remove the stale session before reopening."],"exampleFix":"# before - client v1.2, session was started by v1.5\nplaywright-cli -s=ci screenshot   # throws\n\n# after\nplaywright-cli -s=ci open           # restart session under v1.2\nplaywright-cli -s=ci screenshot","handlingStrategy":"validation","validationCode":"import { compareSemver } from '../utils/socketConnection';\nfunction isClientCompatible(clientVersion: string, sessionVersion: string): boolean {\n  return compareSemver(clientVersion, sessionVersion) >= 0;\n}\nif (!isClientCompatible(clientInfo.version, session.config.version)) {\n  // prompt user to run `playwright-cli open` instead of attempting run","typeGuard":"function isIncompatibleVersionError(e: unknown): boolean {\n  return e instanceof Error && e.message.startsWith('Client is v');\n}","tryCatchPattern":"try {\n  await session.run(clientInfo, args);\n} catch (e) {\n  if (isIncompatibleVersionError(e)) {\n    await Session.startDaemon(clientInfo, { session: session.name } as any, 'open');\n    await session.run(clientInfo, args);\n  } else throw e;\n}","preventionTips":["Reopen sessions after upgrading or downgrading the playwright client.","Pin the playwright-cli version in CI to match the runtime daemon version.","Call session.stop() during teardown to avoid stale-version sessions across deploys."],"tags":["session","versioning","daemon","cli"],"backgroundTag":null,"analyzedSha":"c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6","analyzedAt":"2026-08-12T07:26:36.950Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}