vitest-dev/vitest · error · Error

${inspectOption} does not work with ${browserConfig} Use ei

Error message

${inspectOption} does not work with
${browserConfig}

Use either:
${correctExample}

...or disable ${inspectOption}

What it means

Node's --inspect / --inspect-brk debugger attaches via CDP and only works with Chromium-based browser instances. resolveProjects.ts:695-747 rejects a non-chromium (or non-preview-provider) browser instance when globalConfig.inspect or globalConfig.inspectBrk is set, printing the inspect flag, the offending browser config, the correct chromium example, and suggesting you disable inspect.

Source

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

          const coverageExample = `
{
  coverage: {
    provider: 'istanbul',
  },
}
            `.trim()

          throw new Error(
            `@vitest/coverage-v8 does not work with\n${browserConfig}\n`
            + `\nUse either:\n${correctExample}`
            + `\n\n...or change your coverage provider to:\n${coverageExample}\n`,
          )
        }

        if (globalConfig.inspect || globalConfig.inspectBrk) {
          const inspectOption = `--inspect${globalConfig.inspectBrk ? '-brk' : ''}`

          throw new Error(
            `${inspectOption} does not work with\n${browserConfig}\n`
            + `\nUse either:\n${correctExample}`
            + `\n\n...or disable ${inspectOption}\n`,
          )
        }
      }

      if (names.has(name)) {
        throw new Error(
          [
            `Cannot define a nested project for a ${browser} browser. The project name "${name}" was already defined. `,
            'If you have multiple instances for the same browser, make sure to define a custom "name". ',
            'All projects should have unique names. Make sure your configuration is correct.',
          ].join(''),
        )
      }
      names.add(name)

View on GitHub (pinned to d568f8ce37)

Solutions

  1. Use a Chromium instance (chromium under playwright, chrome/edge under preview) when debugging with --inspect.
  2. Remove --inspect / --inspect-brk from the vitest invocation if you need non-Chromium browsers in the same run.
  3. Run two separate vitest invocations: one with --inspect on a chromium project, one without for the firefox/webkit project.

Example fix

// before: package.json
"scripts": { "test": "vitest --inspect" }
// config: browser.instances includes firefox

// after: scope debugging to a chromium-only run
"scripts": {
  "test:debug": "vitest --inspect --project=chromium-project",
  "test": "vitest"
}
Defensive patterns

Strategy: validation

Validate before calling

if ((globalConfig.inspect || globalConfig.inspectBrk) && instances.some(i => !isChromiumName(provider, i.browser))) {
  throw new Error('--inspect only works with chromium instances; remove the flag or restrict instances')
}

Type guard

function debugCompatible(provider: string, instances: { browser: string }[]): boolean {
  return instances.every(i => isChromiumName(provider, i.browser))
}

Prevention

When it happens

Trigger: Running vitest --inspect (or --inspect-brk) while a browser instance is firefox/webkit, or while using a non-chromium browser name under a non-preview provider.

Common situations: Debugging a Node-side test with --inspect while browser mode also runs a firefox instance; a global inspect flag in the dev script that hits a multi-browser project.

Related errors


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