{"record":{"id":"21dbbf574ca56ef4","repo":"microsoft/playwright","slug":"tracing-is-only-available-in-chromium","errorCode":null,"errorMessage":"Tracing is only available in Chromium","messagePattern":"Tracing is only available in Chromium","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/playwright-core/src/server/dispatchers/browserDispatcher.ts","lineNumber":123,"sourceCode":"    await this._object.killForTests(progress);\n  }\n\n  async defaultUserAgentForTest(): Promise<channels.BrowserDefaultUserAgentForTestResult> {\n    return { userAgent: this._object.userAgent() };\n  }\n\n  async newBrowserCDPSession(params: channels.BrowserNewBrowserCDPSessionParams, progress: Progress): Promise<channels.BrowserNewBrowserCDPSessionResult> {\n    // Note: progress is ignored because this operation is not cancellable and should not block in the browser anyway.\n    if (this._object.options.browserType !== 'chromium')\n      throw new Error(`CDP session is only available in Chromium`);\n    const crBrowser = this._object as CRBrowser;\n    return { session: new CDPSessionDispatcher(this, await progress.race(crBrowser.newBrowserCDPSession())) };\n  }\n\n  async startTracing(params: channels.BrowserStartTracingParams, progress: Progress): Promise<void> {\n    // Note: progress is ignored because this operation is not cancellable and should not block in the browser anyway.\n    if (this._object.options.browserType !== 'chromium')\n      throw new Error(`Tracing is only available in Chromium`);\n    const crBrowser = this._object as CRBrowser;\n    await progress.race(crBrowser.startTracing(params.page ? (params.page as PageDispatcher)._object : undefined, params));\n  }\n\n  async stopTracing(params: channels.BrowserStopTracingParams, progress: Progress): Promise<channels.BrowserStopTracingResult> {\n    // Note: progress is ignored because this operation is not cancellable and should not block in the browser anyway.\n    if (this._object.options.browserType !== 'chromium')\n      throw new Error(`Tracing is only available in Chromium`);\n    const crBrowser = this._object as CRBrowser;\n    return { artifact: ArtifactDispatcher.from(this, await progress.race(crBrowser.stopTracing())) };\n  }\n\n  async startServer(params: channels.BrowserStartServerParams, progress: Progress): Promise<channels.BrowserStartServerResult> {\n    return await this._object.startServer(progress, params.title, params);\n  }\n\n  async stopServer(params: channels.BrowserStopServerParams, progress: Progress): Promise<void> {\n    await this._object.stopServer(progress);","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/microsoft/playwright/blob/c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6/packages/playwright-core/src/server/dispatchers/browserDispatcher.ts#L105-L141","documentation":"Thrown by BrowserDispatcher.startTracing() when the browser is not chromium. This is the CDP-backed Browser.startTracing/stopTracing pair (performance tracing), which relies on Chromium's Tracing domain. Firefox and WebKit do not implement it, so the call is rejected before reaching the browser. Note this is distinct from BrowserContext.tracing, the higher-level cross-browser Playwright tracing API.","triggerScenarios":"Calling browser.startTracing(params) (the Browser-level RPC) on a firefox or webkit browser. Happens in helpers that invoke raw browser tracing across all projects, or code that confused Browser.startTracing with context.tracing.start.","commonSituations":"Mixing up the chromium-only Browser CDP tracing with the cross-browser context.tracing; performance test suites that assume CDP tracing works on every browser.","solutions":["Use context.tracing.start/stop instead — it is the supported cross-browser API and is what Playwright's own tracing uses.","If you specifically need the Browser-level CDP tracer, restrict it to chromium projects via a browserType name check."],"exampleFix":"// before: chromium-only browser-level tracing\nawait browser.startTracing({ page, path: 'trace.json' });\n\n// after: cross-browser Playwright tracing\nawait context.tracing.start({ screenshots: true, snapshots: true });\n// ... run ...\nawait context.tracing.stop({ path: 'trace.zip' });","handlingStrategy":"validation","validationCode":"if (browser.browserType().name() !== 'chromium') {\n  // use context.tracing.start instead — cross-browser\n} else {\n  await browser.startTracing(params);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Default to context.tracing (cross-browser); reach for Browser.startTracing only when you need the raw CDP tracer on chromium.","Tag any helper using Browser.startTracing as chromium-only.","Run multi-browser CI to catch chromium-only tracing assumptions early."],"tags":["tracing","chromium","browser","cdp"],"backgroundTag":null,"analyzedSha":"c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6","analyzedAt":"2026-08-12T07:26:36.950Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}