microsoft/playwright · error · TraceVersionError

The trace was created by a newer version of Playwright and i

Error message

The trace was created by a newer version of Playwright and is not supported by this version of the viewer. Please use latest Playwright to open the trace.

What it means

Thrown as a TraceVersionError by TraceModernizer when a `context-options` event's `version` exceeds `latestVersion` known to this build of the viewer. The trace format is forward-incompatible: older viewers cannot interpret newer trace schemas, so the modernizer refuses to continue.

Source

Thrown at packages/isomorphic/trace/traceModernizer.ts:87

      this._contextEntry.pages.push(pageEntry);
    }
    return pageEntry;
  }

  private _appendEvent(line: string) {
    if (!line)
      return;
    const events = this._modernize(JSON.parse(line));
    for (const event of events)
      this._innerAppendEvent(event);
  }

  private _innerAppendEvent(event: trace.TraceEvent) {
    const contextEntry = this._contextEntry;
    switch (event.type) {
      case 'context-options': {
        if (event.version > latestVersion)
          throw new TraceVersionError('The trace was created by a newer version of Playwright and is not supported by this version of the viewer. Please use latest Playwright to open the trace.');
        this._version = event.version;
        contextEntry.origin = event.origin;
        contextEntry.browserName = event.browserName;
        contextEntry.channel = event.channel;
        contextEntry.title = event.title;
        contextEntry.platform = event.platform;
        contextEntry.playwrightVersion = event.playwrightVersion;
        contextEntry.wallTime = event.wallTime;
        contextEntry.monotonicTime = event.monotonicTime;
        contextEntry.startTime = event.monotonicTime;
        contextEntry.sdkLanguage = event.sdkLanguage;
        contextEntry.options = event.options;
        contextEntry.testIdAttributeName = event.testIdAttributeName;
        contextEntry.testTimeout = event.testTimeout;
        contextEntry.annotations = event.annotations;
        break;
      }
      case 'screencast-frame': {

View on GitHub (pinned to c8fc3bf8d3)

Solutions

  1. Upgrade the local Playwright/trace-viewer to at least the version that recorded the trace.
  2. Re-record the trace with the currently installed Playwright version.
  3. Pin the recording environment to the same Playwright version as consumers.

Example fix

// before: viewer 1.40 opening trace from 1.50
npx playwright show-trace new-trace.zip  // -> TraceVersionError

// after
npm i -D @playwright/test@latest
npx playwright show-trace new-trace.zip
Defensive patterns

Strategy: validation

Validate before calling

import { version as viewerVersion } from 'playwright-core/package.json';
function assertVersionCompatible(traceRecordedWith: string) {
  if (semver.lt(viewerVersion, traceRecordedWith))
    throw new Error(`Viewer ${viewerVersion} < trace recorder ${traceRecordedWith}; upgrade Playwright`);
}

Type guard

function viewerCanReadTrace(viewerVer: string, traceVer: string): boolean {
  return semver.gte(viewerVer, traceVer);
}

Try / catch

try {
  await traceLoader.load(backend, file);
} catch (e) {
  if (e instanceof TraceVersionError || /newer version of Playwright/.test(e.message)) {
    console.error('Upgrade @playwright/test to the version that recorded this trace, then retry.');
    process.exit(3);
  }
  throw e;
}

Prevention

When it happens

Trigger: Opening a trace recorded by a newer Playwright/trace-viewer with an older installed version; e.g. trace from Playwright 1.50 opened in viewer 1.40. The check is `event.version > latestVersion` in `_innerAppendEvent` for events of type `context-options`.

Common situations: CI artifacts recorded with latest Playwright but inspected locally with an older CLI; mismatched `@playwright/test` and trace-viewer versions; a teammate shares a trace recorded on a newer release.

Related errors


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