vitest-dev/vitest · error · TypeError

The provider does not support tracing.

Error message

The ${provider.name} provider does not support tracing.

What it means

Tracing in Vitest browser mode is implemented exclusively on the Playwright provider via `context.tracing.*`. startTracing guards with isPlaywrightProvider(provider) and throws a TypeError for any other provider name (e.g. webdriverio, preview). The trace config exists but only the playwright provider wires it to Playwright's tracing engine.

Solutions

  1. Set `provider: 'playwright'` in the browser project config when you need traces.
  2. Disable tracing if you must use webdriverio/preview: `browser: { trace: false }` or omit trace config.
  3. If authoring a custom provider, implement tracing by extending the Playwright provider or document that tracing is unsupported and ensure the runner does not call startTracing.

Example fix

// before
export default defineConfig({
  test: { browser: { provider: 'webdriverio', trace: { screenshots: true } } },
})

// after
export default defineConfig({
  test: { browser: { provider: 'playwright', trace: { screenshots: true } } },
})
Defensive patterns

Strategy: validation

Validate before calling

// in vitest.config — only enable trace for the playwright project
const useTrace = process.env.BROWSER_PROVIDER === 'playwright'
export default defineConfig({
  test: {
    projects: [{
      test: {
        name: 'browser',
        browser: { provider: 'playwright', trace: useTrace ? 'on' : 'off' },
      },
    }],
  },
})

Type guard

import type { BrowserProvider } from 'vitest/node'

function supportsTracing(provider: BrowserProvider): boolean {
  return provider.name === 'playwright'
}

Prevention

When it happens

Trigger: Configuring `browser.trace` and running with `provider: 'webdriverio'` or a custom/third-party provider while startTracing is invoked (typically automatically by the runner at test start).

Common situations: Switching provider from playwright to webdriverio without disabling tracing; using the preview provider with tracing enabled; writing a custom provider that does not implement tracing.

Related errors


AI-assisted analysis of vitest-dev/vitest@1fa9837ec2 (2026-08-11). Data as JSON: /api/errors/47a6eb7a337f6a5d. Report an issue: GitHub.

Appendix: source

Thrown at packages/browser-playwright/src/commands/trace.ts:27

export const startTracing: BrowserCommand<[]> = async ({ context, project, provider, sessionId }) => {
  if (isPlaywrightProvider(provider)) {
    if (provider.tracingContexts.has(sessionId)) {
      return
    }

    provider.tracingContexts.add(sessionId)
    const options = project.config.browser!.trace
    await context.tracing.start({
      screenshots: options.screenshots ?? true,
      snapshots: options.snapshots ?? true,
      sources: options.sources ?? true,
    }).catch(() => {
      provider.tracingContexts.delete(sessionId)
    })
    return
  }
  throw new TypeError(`The ${provider.name} provider does not support tracing.`)
}

export const startChunkTrace: BrowserCommand<[{ name: string; title: string }]> = async (
  command,
  { name, title },
) => {
  const { provider, sessionId, testPath, context } = command
  if (!testPath) {
    throw new Error(`stopChunkTrace cannot be called outside of the test file.`)
  }
  if (isPlaywrightProvider(provider)) {
    if (!provider.tracingContexts.has(sessionId)) {
      await startTracing(command)
    }
    const path = resolveTracesPath(command, name)
    provider.pendingTraces.set(path, sessionId)
    await context.tracing.startChunk({ name, title })
    return

View on GitHub (pinned to 1fa9837ec2)