vitest-dev/vitest · error · Error
The browser configuration must have a "name" property. This…
Error message
The browser configuration must have a "name" property. This is a bug in Vitest. Please, open a new issue with reproduction
What it means
An internal invariant: after confirming instance.browser exists, Vitest reads instance.name. The name is assigned by Vitest during config normalization, so a missing/null name means normalization did not run correctly. The message explicitly says this is a bug in Vitest.
Solutions
- Reinstall and rebuild Vitest to rule out a stale build.
- Ensure a single Vitest version across the workspace.
- Avoid manually constructing browser instance objects; declare them via config only.
- If reproducible with standard config, file a Vitest issue with the reproduction.
Defensive patterns
Strategy: try-catch
Type guard
const instanceHasName = (inst: unknown): inst is { name: string; browser: string } =>
typeof inst === 'object' && inst !== null && typeof (inst as any).name === 'string' && typeof (inst as any).browser === 'string' Try / catch
try {
await resolveProjects(...)
} catch (err) {
if (err instanceof Error && err.message.includes('"name" property. This is a bug in Vitest')) {
// rebuild/reinstall Vitest; report if reproducible
throw new Error('Vitest failed to normalize browser instance names; rebuild and retry', { cause: err })
}
throw err
} Prevention
- Always declare instances via config (let Vitest normalize names).
- Keep a single Vitest version; rebuild after source edits.
- Do not hand-construct raw instance objects.
When it happens
Trigger: instance.name is null/undefined during instance expansion, which should not happen because Vitest derives names earlier in the pipeline.
Common situations: A broken/partial Vitest build, version skew between config normalization and resolution code, or a custom code path that constructs raw browser instance objects bypassing normalization.
Related errors
- Browser name is required. Please, set…
- The browser configuration must have a "browser" property…
- The instance cannot have a different provider from its…
- All browser instances within a project must use the same…
- "browser.instances" was set in the config, but the array is…
AI-assisted analysis of vitest-dev/vitest@1fa9837ec2 (2026-08-11).
Data as JSON: /api/errors/1fc15837fd92680d.
Report an issue: GitHub.
Appendix: source
Thrown at packages/vitest/src/node/projects/resolveProjects.ts:882
}
// 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: [
${(filteredInstances || []).map(i => `{ browser: '${i.browser}' }`).join(',\n ')}
],
},
}View on GitHub (pinned to 1fa9837ec2)