microsoft/playwright · error · Error

HAR recording has already been started

Error message

HAR recording has already been started

What it means

Error "HAR recording has already been started" thrown in microsoft/playwright.

Source

Thrown at packages/playwright-core/src/client/tracing.ts:106

  }

  async stopChunk(options: { path?: string } = {}) {
    await this._wrapApiCall(async () => {
      await this._doStopChunk(options.path);
    });
  }

  async stop(options: { path?: string } = {}) {
    await this._wrapApiCall(async () => {
      await this._doStopChunk(options.path);
      await this._channel.tracingStop({}, kNoTimeout);
    });
  }

  async startHar(path: string, options: { content?: 'embed' | 'attach' | 'omit', mode?: 'full' | 'minimal', urlFilter?: string | RegExp, resourcesDir?: string } = {}) {
    await this._wrapApiCall(async () => {
      if (this._harId)
        throw new Error('HAR recording has already been started');
      if (options.resourcesDir && path.endsWith('.zip'))
        throw new Error('resourcesDir option is not compatible with a .zip har file');
      const defaultContent = path.endsWith('.zip') ? 'attach' : 'embed';
      this._harId = await this._recordIntoHAR(path, null, {
        url: options.urlFilter,
        updateContent: options.content ?? defaultContent,
        updateMode: options.mode ?? 'full',
        resourcesDir: options.resourcesDir,
      });
    });
    return new DisposableStub(() => this.stopHar());
  }

  async stopHar() {
    await this._wrapApiCall(async () => {
      const harId = this._harId;
      if (!harId)
        throw new Error('HAR recording has not been started');

View on GitHub (pinned to c8fc3bf8d3)

When it happens

Trigger: Thrown at packages/playwright-core/src/client/tracing.ts:106 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/b09d6b07984173be. Report an issue: GitHub.