vitest-dev/vitest · error · Error

The browser configuration must have a "browser" property. Th

Error message

The browser configuration must have a "browser" property. The ${nth}${ending} item in "browser.instances" doesn't have it. Make sure your${projectConfig.name ? ` "${projectConfig.name}"` : ''} configuration is correct.

What it means

During browser-instance expansion (resolveProjects.ts:677-683), each item in browser.instances must specify which browser to launch via a `browser` field. If an instance object omits it, Vitest throws, naming the 1-based ordinal (with st/nd/rd/th suffix) and the parent project name when available.

Source

Thrown at packages/vitest/src/node/projects/resolveProjects.ts:682

      ? instances
      : instances.filter(instance => matchesProjectFilter(globalConfig.project, instance.name!))
    if (!filteredInstances.length) {
      continue
    }

    // Keep the parent in the entry list as `hidden` so a `TestProject` is
    // created (instances link to it via `_parent` for the browser provider).
    // The parent's name is removed from `names` because the instance names
    // take its place in the user-facing project list.
    names.delete(parentName)
    result.push({ ...entry, hidden: true })

    filteredInstances.forEach((instance, index) => {
      const browser = instance.browser
      if (!browser) {
        const nth = index + 1
        const ending = nth === 2 ? 'nd' : nth === 3 ? 'rd' : 'th'
        throw new Error(`The browser configuration must have a "browser" property. The ${nth}${ending} item in "browser.instances" doesn't have it. Make sure your${projectConfig.name ? ` "${projectConfig.name}"` : ''} configuration is correct.`)
      }
      const name = instance.name
      if (name == null) {
        throw new Error(`The browser configuration must have a "name" property. This is a bug in Vitest. Please, open a new issue with reproduction`)
      }
      if (instance.provider?.name != null && projectConfig.browser.provider?.name != null && instance.provider?.name !== projectConfig.browser.provider?.name) {
        throw new Error(`The instance cannot have a different provider from its parent. The "${name}" instance specifies "${instance.provider?.name}" provider, but its parent has a "${projectConfig.browser.provider?.name}" provider.`)
      }

      const provider = instance.provider?.name ?? projectConfig.browser.provider?.name ?? 'preview'

      // Browser-mode CDP only features:
      if (provider === 'preview' || !isChromiumName(provider, browser)) {
        const browserConfig = `
{
  browser: {
    provider: ${provider}(),
    instances: [

View on GitHub (pinned to d568f8ce37)

Solutions

  1. Add the `browser` field to every item: { browser: 'chromium', name: 'chromium' }, { browser: 'firefox', name: 'firefox' }.
  2. Double-check the spelling: it's `browser`, not `browserName` or `type`.
  3. Validate your instances array shape with a quick loop before running.

Example fix

// before
test: { browser: { enabled: true, provider: 'playwright', instances: [
  { name: 'chrome' }, { name: 'firefox' },
] } }

// after
test: { browser: { enabled: true, provider: 'playwright', instances: [
  { browser: 'chromium', name: 'chromium' }, { browser: 'firefox', name: 'firefox' },
] } }
Defensive patterns

Strategy: type-guard

Validate before calling

for (const [i, inst] of config.browser.instances.entries()) {
  if (!inst.browser) throw new Error(`Instance #${i + 1} missing required 'browser' field`)
}

Type guard

function isValidInstance(inst: unknown): inst is { browser: string; name?: string } {
  return !!inst && typeof inst === 'object' && typeof (inst as any).browser === 'string'
}

Prevention

When it happens

Trigger: Defining browser.instances as [{ name: 'chrome' }, { name: 'firefox' }] where each object has a name but no browser field; an instance built dynamically that drops the browser key; copy-pasting an instance template that used a different shape.

Common situations: Confusing the `name` (project label) and `browser` (browser engine) fields; upgrading from an older API where browser was inferred; typos like 'broswer'; instances constructed from a map that loses the browser key.

Related errors


AI-assisted analysis of vitest-dev/vitest@d568f8ce37 (2026-08-03). Data as JSON: /data/errors/c40a96e16d47e7c2.json. Report an issue: GitHub.