vitest-dev/vitest · error · Error

Vitest wasn't able to resolve any project.${resolved.browser

Error message

Vitest wasn't able to resolve any project.${resolved.browser.enabled && !resolved.browser.instances?.length ? ` Please, check that you specified the "browser.instances" option.` : ``}

What it means

Vitest could not resolve any project at all — the workspace yielded zero projects and no --project filter was set. When browser mode is on but no instances are configured, the message appends a hint about `browser.instances`. core.ts:426-430 throws this generic resolution failure.

Source

Thrown at packages/vitest/src/node/core.ts:430

    }))

    if (resolved.cliOptions.browser?.enabled) {
      const browserProjects = this.projects.filter(p => p.config.browser.enabled)
      if (!browserProjects.length) {
        throw new Error(`Vitest received --browser flag, but no project had a browser configuration.`)
      }
    }
    if (!this.projects.length) {
      const filter = toArray(resolved.project).join('", "')
      if (filter) {
        throw new Error(`No projects matched the filter "${filter}".`)
      }
      else {
        let error = `Vitest wasn't able to resolve any project.`
        if (resolved.browser.enabled && !resolved.browser.instances?.length) {
          error += ` Please, check that you specified the "browser.instances" option.`
        }
        throw new Error(error)
      }
    }

    if (!this.coreWorkspaceProject) {
      this.coreWorkspaceProject = TestProject._createBasicProject(this)
    }

    if (resolved.testNamePattern) {
      this.configOverride.testNamePattern = resolved.testNamePattern
    }

    // populate will merge all configs into every project,
    // we don't want that when just listing tags
    if (!resolved.listTags) {
      populateProjectsTags(this.coreWorkspaceProject, this.projects)
    }

    this.reporters = await createReporters(resolved.reporters, this)

View on GitHub (pinned to d568f8ce37)

Solutions

  1. Ensure a valid vitest.config.ts or vitest.workspace.ts exists at the project root and exports a config.
  2. If browser mode is on, define at least one instance: `browser: { enabled: true, instances: [{ browser: 'chromium' }] }`.
  3. Run `vitest --config <path>` to point Vitest at the config explicitly if it is not at the default location.
  4. Verify your workspace file's glob patterns actually match test directories.

Example fix

// before — browser enabled, no instances
export default defineConfig({ test: { browser: { enabled: true } } })
// after
export default defineConfig({ test: { browser: { enabled: true, instances: [{ browser: 'chromium' }] } } })
Defensive patterns

Strategy: validation

Validate before calling

function assertResolvableConfig(config: any) {
  if (!config) throw new Error('No vitest config resolved; ensure vitest.config.ts exists.')
  if (config.browser?.enabled && !(config.browser.instances?.length)) {
    throw new Error('Browser enabled but no browser.instances defined.')
  }
}

Type guard

function isConfigResolvable(config: any): boolean {
  return !!config && (!config.browser?.enabled || (config.browser.instances?.length ?? 0) > 0)
}

Prevention

When it happens

Trigger: Run vitest with no config, a broken workspace file, or `test.browser.enabled: true` without any `browser.instances` (and no default applies).

Common situations: Empty or mis-located vitest.workspace.ts; config file not picked up due to wrong path; browser enabled without instances; broken project glob.

Related errors


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