vitest-dev/vitest · error · TypeError

The provider does not support tracing.

Error message

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

What it means

stopChunkTrace finalizes a named trace chunk by calling `context.context.tracing.stopChunk({ path })` and writing the zip. This is Playwright-specific; for any non-playwright provider the function falls through and throws a TypeError. The path resolution and pendingTraces bookkeeping also depend on Playwright provider internals.

Solutions

  1. Run tracing exclusively under `provider: 'playwright'`.
  2. Turn tracing off for non-playwright provider configurations.
  3. Ensure no stale trace commands are dispatched after switching providers (restart vitest).

Example fix

// before
test: { browser: { provider: 'preview' } }  // preview has no tracing

// after
test: { browser: { provider: 'playwright', trace: 'on' } }
Defensive patterns

Strategy: validation

Validate before calling

const provider = 'playwright'
export default defineConfig({
  test: { browser: { provider, trace: provider === 'playwright' ? 'on-all' : false } },
})

Type guard

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

Prevention

When it happens

Trigger: Provider is webdriverio/preview/custom and the runner tries to stop a trace chunk it never started, or a chunk command was queued before the provider switched.

Common situations: Provider mismatch with trace config; running the same suite under multiple providers where one does not support tracing; custom provider that lacks tracing.

Related errors


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

Appendix: source

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

    await context.tracing.startChunk({ name, title })
    return
  }
  throw new TypeError(`The ${provider.name} provider does not support tracing.`)
}

export const stopChunkTrace: BrowserCommand<[{ name: string }]> = async (
  context,
  { name },
) => {
  if (isPlaywrightProvider(context.provider)) {
    const path = resolveTracesPath(context, name)
    assertBrowserApiWrite(context.project, path)
    assertBrowserFileAccess(context.project, path)
    context.provider.pendingTraces.delete(path)
    await context.context.tracing.stopChunk({ path })
    return { tracePath: path }
  }
  throw new TypeError(`The ${context.provider.name} provider does not support tracing.`)
}

export const markTrace: BrowserCommand<[payload: { name: string; element?: SerializedLocator; stack?: string }]> = async (
  context,
  payload,
) => {
  if (isPlaywrightProvider(context.provider)) {
    // skip if tracing is not active
    // this is only safe guard and this isn't expected to happen since
    // runner already checks if tracing is active before sending this command
    if (!context.provider.tracingContexts.has(context.sessionId)) {
      return
    }
    const { name, element, stack } = payload
    const location = parseLocation(context, stack)
    // mark trace via group/groupEnd with dummy calls to force snapshot.
    // https://github.com/microsoft/playwright/issues/39308
    await context.context.tracing.group(name, { location })

View on GitHub (pinned to 1fa9837ec2)