microsoft/playwright · error · Error
Tracing is only available in Chromium
Error message
Tracing is only available in Chromium
What it means
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.
Source
Thrown at packages/playwright-core/src/server/dispatchers/browserDispatcher.ts:123
await this._object.killForTests(progress);
}
async defaultUserAgentForTest(): Promise<channels.BrowserDefaultUserAgentForTestResult> {
return { userAgent: this._object.userAgent() };
}
async newBrowserCDPSession(params: channels.BrowserNewBrowserCDPSessionParams, progress: Progress): Promise<channels.BrowserNewBrowserCDPSessionResult> {
// Note: progress is ignored because this operation is not cancellable and should not block in the browser anyway.
if (this._object.options.browserType !== 'chromium')
throw new Error(`CDP session is only available in Chromium`);
const crBrowser = this._object as CRBrowser;
return { session: new CDPSessionDispatcher(this, await progress.race(crBrowser.newBrowserCDPSession())) };
}
async startTracing(params: channels.BrowserStartTracingParams, progress: Progress): Promise<void> {
// Note: progress is ignored because this operation is not cancellable and should not block in the browser anyway.
if (this._object.options.browserType !== 'chromium')
throw new Error(`Tracing is only available in Chromium`);
const crBrowser = this._object as CRBrowser;
await progress.race(crBrowser.startTracing(params.page ? (params.page as PageDispatcher)._object : undefined, params));
}
async stopTracing(params: channels.BrowserStopTracingParams, progress: Progress): Promise<channels.BrowserStopTracingResult> {
// Note: progress is ignored because this operation is not cancellable and should not block in the browser anyway.
if (this._object.options.browserType !== 'chromium')
throw new Error(`Tracing is only available in Chromium`);
const crBrowser = this._object as CRBrowser;
return { artifact: ArtifactDispatcher.from(this, await progress.race(crBrowser.stopTracing())) };
}
async startServer(params: channels.BrowserStartServerParams, progress: Progress): Promise<channels.BrowserStartServerResult> {
return await this._object.startServer(progress, params.title, params);
}
async stopServer(params: channels.BrowserStopServerParams, progress: Progress): Promise<void> {
await this._object.stopServer(progress);View on GitHub (pinned to c8fc3bf8d3)
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.
Example fix
// before: chromium-only browser-level tracing
await browser.startTracing({ page, path: 'trace.json' });
// after: cross-browser Playwright tracing
await context.tracing.start({ screenshots: true, snapshots: true });
// ... run ...
await context.tracing.stop({ path: 'trace.zip' }); Defensive patterns
Strategy: validation
Validate before calling
if (browser.browserType().name() !== 'chromium') {
// use context.tracing.start instead — cross-browser
} else {
await browser.startTracing(params);
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- page: expected Page or Frame
- CDP session is only available in Chromium
- Could not connect to ${channel}.\n${remoteDebuggingHint(chan
- Playwright manages remote debugging connection itself.
- Connecting to ${channel} by channel name is not supported on
AI-assisted analysis of microsoft/playwright@c8fc3bf8d3 (2026-08-12).
Data as JSON: /api/errors/21dbbf574ca56ef4.
Report an issue: GitHub.