microsoft/playwright · warning · Error

Method not implemented.

Error message

Method not implemented.

What it means

`requestGC` on Firefox BiDi evaluates `TestUtils.gc()` in the page; if that helper is absent (Firefox build without it, or it throws), Playwright reports the feature as not implemented. Triggering garbage collection isn't supported by this browser backend.

Solutions

  1. Gate `requestGC` by browser — only call on Chromium/WebKit
  2. Wrap in try/catch on Firefox and ignore 'Method not implemented'
  3. Restructure tests to not rely on forced GC in Firefox

Example fix

// before
await page.requestGC();

// after
const cap = page.context().browser()?.browserType().name();
if (cap !== 'firefox') await page.requestGC();
// or
try { await page.requestGC(); } catch (e) { /* unsupported on firefox */ }
Defensive patterns

Strategy: try-catch

Validate before calling

const bt = context.browser()?.browserType().name();
if (bt && bt !== 'firefox') {
  await page.requestGC();
}

Try / catch

try {
  await page.requestGC();
} catch (e) {
  if (e instanceof Error && /Method not implemented/.test(e.message)) return;
  throw e;
}

Prevention

When it happens

Trigger: Calling `page.requestGC()` (or memory/MCP tooling that invokes it) on a Firefox BiDi session where `TestUtils.gc` is unavailable, producing an exception result.

Common situations: Running memory-leak or GC-dependent tests against Firefox; cross-browser suites that call requestGC unconditionally; profiling/heap-snapshot tooling that forces GC.

Related errors


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

Appendix: source

Thrown at packages/playwright-core/src/server/bidi/bidiPage.ts:454

      delta: -1,
    }).then(() => true).catch(() => false);
  }

  async goForward(): Promise<boolean> {
    return await this._session.send('browsingContext.traverseHistory', {
      context: this._session.sessionId,
      delta: +1,
    }).then(() => true).catch(() => false);
  }

  async requestGC(): Promise<void> {
    const result = await this._session.send('script.evaluate', {
      expression: 'TestUtils.gc()',
      target: { context: this._session.sessionId },
      awaitPromise: true,
    });
    if (result.type === 'exception')
      throw new Error('Method not implemented.');
  }

  private async _onScriptMessage(event: bidi.Script.MessageParameters) {
    if (event.channel !== kPlaywrightBindingChannel)
      return;
    const pageOrError = await this._page.waitForInitializedOrError();
    if (pageOrError instanceof Error)
      return;
    const context = this._contextIdToContext.get(event.source.realm);
    if (!context)
      return;
    if (event.data.type !== 'string')
      return;
    await this._page.onBindingCalled(event.data.value, context);
  }

  async addInitScript(initScript: InitScript): Promise<void> {
    const { script } = await this._session.send('script.addPreloadScript', {

View on GitHub (pinned to c8fc3bf8d3)