{"record":{"id":"f3d978c38f87e5c2","repo":"apify/crawlee","slug":"function-starttracing-is-not-available-in-inco","errorCode":null,"errorMessage":"Function `startTracing()` is not available in incognito mode","messagePattern":"Function `startTracing\\(\\)` is not available in incognito mode","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/browser-pool/src/playwright/playwright-browser.ts","lineNumber":74,"sourceCode":"\n    browserType(): BrowserType {\n        return this.#browserType!;\n    }\n\n    async newPage(...args: Parameters<BrowserContext['newPage']>): ReturnType<BrowserContext['newPage']> {\n        return this.#browserContext.newPage(...args);\n    }\n\n    async newContext(): Promise<never> {\n        throw new Error('Function `newContext()` is not available in incognito mode');\n    }\n\n    async newBrowserCDPSession(): Promise<never> {\n        throw new Error('Function `newBrowserCDPSession()` is not available in incognito mode');\n    }\n\n    async startTracing(): Promise<never> {\n        throw new Error('Function `startTracing()` is not available in incognito mode');\n    }\n\n    async stopTracing(): Promise<never> {\n        throw new Error('Function `stopTracing()` is not available in incognito mode');\n    }\n}\n","sourceCodeStart":56,"sourceCodeEnd":81,"githubUrl":"https://github.com/apify/crawlee/blob/dbe57fb09ca607ad59dcf998f3925ef9ac3bb26c/packages/browser-pool/src/playwright/playwright-browser.ts#L56-L81","documentation":"Playwright's tracing API lives on the Browser, not on a BrowserContext, so in incognito mode (where the wrapper only exposes an incognito context) startTracing() cannot be supported and always throws. Use context-level tracing via Playwright's tracing module on the underlying context if tracing is needed.","triggerScenarios":"Calling browserController.startTracing() when the Playwright plugin was created with useIncognitoPages: true.","commonSituations":"Recording performance/trace files for debugging or CI artifacts while running with incognito pages; generic browser automation code that unconditionally starts tracing.","solutions":["Use the underlying context's tracing (context.tracing.start()) from the Playwright BrowserContext instead of browser-level startTracing().","Disable tracing calls when useIncognitoPages is true, or run tracing in a separate non-incognito browser instance.","Toggle useIncognitoPages: false if browser-level tracing is essential to your workflow."],"exampleFix":"// before\nawait browserController.startTracing({ path: 'trace.zip' });\n// after\nawait page.context().tracing.start({ screenshots: true });\n// ... work ...\nawait page.context().tracing.stop({ path: 'trace.zip' });","handlingStrategy":"validation","validationCode":"if (!launchContext.useIncognitoPages) {\n  await browserController.startTracing({ path: 'trace.zip' });\n}","typeGuard":"function supportsBrowserTracing(useIncognitoPages: boolean): boolean {\n  return !useIncognitoPages;\n}","tryCatchPattern":"try {\n  await browserController.startTracing(opts);\n} catch (err) {\n  if (err instanceof Error && err.message.includes('startTracing')) {\n    await page.context().tracing.start(opts); // context-level tracing fallback\n  } throw err;\n}","preventionTips":["Prefer context.tracing.start()/stop() which works in both modes.","Wrap tracing start/stop in a helper that checks the incognito flag.","Don't copy tracing code from non-incognito examples without checking the mode."],"tags":["browser-pool","playwright","incognito","tracing"],"backgroundTag":"api-not-supported-in-mode","analyzedSha":"dbe57fb09ca607ad59dcf998f3925ef9ac3bb26c","analyzedAt":"2026-08-30T22:22:28.328Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}