microsoft/playwright · error · Error

Recording requires a newer version of Playwright, please upg

Error message

Recording requires a newer version of Playwright, please upgrade.

What it means

Thrown when the underlying BrowserContext from the (possibly older) installed Playwright runtime does not expose the internal _enableRecorder hook that the tool backend needs. It is a version-skew guard: the tool backend package requires a matching or newer playwright-core runtime to run codegen recording.

Source

Thrown at packages/playwright-core/src/tools/backend/context.ts:246

      await this._startPageVideo(page);
  }

  async stopVideoRecording(): Promise<string[]> {
    if (!this._video)
      return [];
    const video = this._video;
    for (const page of this._rawBrowserContext.pages())
      await page.screencast.stop();
    this._video = undefined;
    return [...video.fileNames];
  }

  async startRecording() {
    if (this._recordedActions)
      throw new Error('Recording is already in progress.');
    const browserContext = await this.ensureBrowserContext() as BrowserContextEx;
    if (typeof browserContext._enableRecorder !== 'function')
      throw new Error('Recording requires a newer version of Playwright, please upgrade.');
    const recordedActions: string[] = [];
    await browserContext._enableRecorder({
      mode: 'recording',
      recorderMode: 'api',
      omitCallTracking: true,
      language: languageGeneratorId(this.codegenLanguage()),
    }, {
      actionAdded: (page, action, code) => {
        recordedActions.push(code);
      },
      actionUpdated: (page, action, code) => {
        if (recordedActions.length)
          recordedActions[recordedActions.length - 1] = code;
        else
          recordedActions.push(code);
      },
      signalAdded: (page, signal, code) => {
        if (recordedActions.length && code)

View on GitHub (pinned to 312030cdce)

Solutions

  1. Upgrade playwright and playwright-core to the same latest version (npm i -D @playwright/test@latest)
  2. Clear npx caches / reinstall so the MCP server bundles a matching runtime
  3. Verify versions align: npm ls playwright-core

Example fix

# before
npx @playwright/mcp@latest   # backed by old playwright-core

# after
npm i -D playwright@latest
npx playwright --version   # confirm matching version
Defensive patterns

Strategy: try-catch

Validate before calling

// Check runtime compatibility before starting:
import { BrowserContext } from 'playwright-core';
const ok = typeof (ctx as any)._enableRecorder === 'function';
if (ok) await backend.startRecording();

Try / catch

try {
  await backend.startRecording();
} catch (e) {
  if ((e as Error).message.includes('newer version of Playwright'))
    throw new Error('Please upgrade playwright to use recording');
  throw e;
}

Prevention

When it happens

Trigger: The MCP/tools backend talks to a browser context produced by an older playwright/playwright-core install where BrowserContext._enableRecorder does not exist (renamed or not yet added), so typeof check fails and the error is thrown.

Common situations: Global MCP server installed with an old playwright version while the project pins a newer @playwright/test; mixed installs via npx picking up a stale cached playwright; using playwright-core version older than the tools package expects.

Related errors


AI-assisted analysis of microsoft/playwright@312030cdce (2026-08-27). Data as JSON: /api/errors/477d0b390663a39f. Report an issue: GitHub.