microsoft/playwright · error · Error
Recording requires a newer version of Playwright, please…
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.
Solutions
- Upgrade playwright and playwright-core to the same latest version (npm i -D @playwright/test@latest)
- Clear npx caches / reinstall so the MCP server bundles a matching runtime
- 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
- Pin the MCP/tools package and playwright to compatible versions in one lockfile
- Run npm ls playwright-core to detect duplicate/old copies
- Upgrade all Playwright packages together, never partially
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
- No recording in progress, use
- Recording is already in progress.
- Cannot use --mobile together with --device, pick one.
- Device emulation is not supported with cdpEndpoint.
- Init page file does not exist
AI-assisted analysis of microsoft/playwright@f1d33b5029 (2026-09-15).
Data as JSON: /api/errors/477d0b390663a39f.
Report an issue: GitHub.
Appendix: source
Thrown at packages/playwright-core/src/tools/backend/context.ts:257
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._startRecording !== 'function')
throw new Error('Recording requires a newer version of Playwright, please upgrade.');
const recordedActions: string[] = [];
await browserContext._startRecording({
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)
recordedActions[recordedActions.length - 1] = code;
},
});View on GitHub (pinned to f1d33b5029)