microsoft/playwright · error · Error

Screencast is already started

Error message

Screencast is already started

What it means

Error "Screencast is already started" thrown in microsoft/playwright.

Source

Thrown at packages/playwright-core/src/client/screencast.ts:44

  private _started = false;
  private _savePath: string | undefined;
  private _onFrame: ((frame: { data: Buffer, timestamp: number, viewportWidth: number, viewportHeight: number }) => Promise<any>) | null = null;
  private _artifact: Artifact | undefined;

  constructor(page: Page) {
    this._page = page;
    this._page._channel.on('screencastFrame', async ({ frameId, data, timestamp, viewportWidth, viewportHeight }) => {
      try {
        await this._onFrame?.({ data, timestamp, viewportWidth, viewportHeight });
      } finally {
        await this._page._channel.screencastFrameAck({ frameId }, kNoTimeout).catch(() => {});
      }
    });
  }

  async start(options: { onFrame?: (frame: { data: Buffer, timestamp: number, viewportWidth: number, viewportHeight: number }) => Promise<any>|any, path?: string, size?: { width: number, height: number }, quality?: number } = {}): Promise<DisposableStub> {
    if (this._started)
      throw new Error('Screencast is already started');
    this._started = true;
    if (options.onFrame)
      this._onFrame = options.onFrame;
    const result = await this._page._channel.screencastStart({
      size: options.size,
      quality: options.quality,
      sendFrames: !!options.onFrame,
      record: !!options.path,
    }, kNoTimeout);
    if (result.artifact) {
      this._artifact = Artifact.from(result.artifact);
      this._savePath = options.path;
    }
    return new DisposableStub(() => this.stop());
  }

  async stop(): Promise<void> {
    await this._page._wrapApiCall(async () => {

View on GitHub (pinned to c8fc3bf8d3)

When it happens

Trigger: Thrown at packages/playwright-core/src/client/screencast.ts:44 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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