microsoft/playwright · warning · Error

Not implemented

Error message

Not implemented

What it means

`setBackgroundColor` in BiDi Firefox only accepts the default (no color) state; passing an explicit RGBA color throws 'Not implemented'. This backs the screenshot transparency / custom background feature which BiDi does not expose.

Source

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

  }

  async closePage(runBeforeUnload: boolean): Promise<void> {
    if (runBeforeUnload) {
      this._session.sendMayFail('browsingContext.close', {
        context: this._session.sessionId,
        promptUnload: runBeforeUnload,
      });
    } else {
      await this._session.send('browsingContext.close', {
        context: this._session.sessionId,
        promptUnload: runBeforeUnload,
      });
    }
  }

  async setBackgroundColor(color?: { r: number; g: number; b: number; a: number; }): Promise<void> {
    if (color)
      throw new Error('Not implemented');
  }

  async takeScreenshot(progress: Progress, format: string, documentRect: types.Rect | undefined, viewportRect: types.Rect | undefined, quality: number | undefined, fitsViewport: boolean, scale: 'css' | 'device'): Promise<Buffer> {
    const rect = (documentRect || viewportRect)!;
    const { data } = await progress.race(this._session.send('browsingContext.captureScreenshot', {
      context: this._session.sessionId,
      format: {
        type: `image/${format === 'png' || format === 'webp' ? format : 'jpeg'}`,
        quality: quality !== undefined ? quality / 100 : undefined,
      },
      origin: documentRect ? 'document' : 'viewport',
      clip: {
        type: 'box',
        ...rect,
      }
    }));
    return Buffer.from(data, 'base64');
  }

View on GitHub (pinned to c8fc3bf8d3)

Solutions

  1. Don't set a custom background color for Firefox BiDi sessions
  2. Omit the color option / pass undefined
  3. Use Chromium if this feature is required

Example fix

// before
// options携带 backgroundColor
await browser.newContext({ ...opts, colorScheme: 'dark' /* + bgColor */ });

// after — omit background color on firefox-bidi
const ctx = await browser.newContext({ /* no backgroundColor */ });
Defensive patterns

Strategy: validation

Validate before calling

const isBidiFirefox = /* detect channel */ false;
if (bgColor && !isBidiFirefox) {
  // pass background color option
} else {
  // omit background color
}

Try / catch

try {
  // setBackgroundcolor / context option with color
} catch (e) {
  if (e instanceof Error && e.message === 'Not implemented') {
    // feature unsupported on this backend; proceed without it
  }
  throw e;
}

Prevention

When it happens

Trigger: Invoking the internal setBackgroundColor with an RGBA color, or using context/screenshot options that request a custom background color on Firefox over BiDi.

Common situations: Using transparent-background screenshots or a custom context background color with Firefox BiDi; porting Chromium-only screenshot setups to Firefox.

Related errors


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