{"record":{"id":"a1ad1ab0847f3aba","repo":"microsoft/playwright","slug":"har-recording-has-not-been-started","errorCode":null,"errorMessage":"HAR recording has not been started","messagePattern":"HAR recording has not been started","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/playwright-core/src/client/tracing.ts","lineNumber":124,"sourceCode":"        throw new Error('HAR recording has already been started');\n      if (options.resourcesDir && path.endsWith('.zip'))\n        throw new Error('resourcesDir option is not compatible with a .zip har file');\n      const defaultContent = path.endsWith('.zip') ? 'attach' : 'embed';\n      this._harId = await this._recordIntoHAR(path, null, {\n        url: options.urlFilter,\n        updateContent: options.content ?? defaultContent,\n        updateMode: options.mode ?? 'full',\n        resourcesDir: options.resourcesDir,\n      });\n    });\n    return new DisposableStub(() => this.stopHar());\n  }\n\n  async stopHar() {\n    await this._wrapApiCall(async () => {\n      const harId = this._harId;\n      if (!harId)\n        throw new Error('HAR recording has not been started');\n      this._harId = undefined;\n      await this._exportHAR(harId);\n    });\n  }\n\n  async _recordIntoHAR(har: string, page: Page | null, options: { url?: string | RegExp, updateContent?: 'attach' | 'embed' | 'omit', updateMode?: 'minimal' | 'full', resourcesDir?: string } = {}): Promise<string> {\n    const isZip = har.endsWith('.zip');\n    const { harId } = await this._channel.harStart({\n      page: page?._channel,\n      options: {\n        content: options.updateContent ?? 'attach',\n        urlGlob: isString(options.url) ? options.url : undefined,\n        urlRegexSource: isRegExp(options.url) ? options.url.source : undefined,\n        urlRegexFlags: isRegExp(options.url) ? options.url.flags : undefined,\n        mode: options.updateMode ?? 'minimal',\n        harPath: isZip ? undefined : har,\n        resourcesDir: options.resourcesDir,\n      },","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/microsoft/playwright/blob/c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6/packages/playwright-core/src/client/tracing.ts#L106-L142","documentation":"Error \"HAR recording has not been started\" thrown in microsoft/playwright.","triggerScenarios":"Thrown at packages/playwright-core/src/client/tracing.ts:124 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6","analyzedAt":"2026-08-12T07:26:36.950Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}