{"id":"1fc15837fd92680d","repo":"vitest-dev/vitest","slug":"the-browser-configuration-must-have-a-name-prope","errorCode":null,"errorMessage":"The browser configuration must have a \"name\" property. This is a bug in Vitest. Please, open a new issue with reproduction","messagePattern":"The browser configuration must have a \"name\" property\\. This is a bug in Vitest\\. Please, open a new issue with reproduction","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/vitest/src/node/projects/resolveProjects.ts","lineNumber":686,"sourceCode":"    }\n\n    // Keep the parent in the entry list as `hidden` so a `TestProject` is\n    // created (instances link to it via `_parent` for the browser provider).\n    // The parent's name is removed from `names` because the instance names\n    // take its place in the user-facing project list.\n    names.delete(parentName)\n    result.push({ ...entry, hidden: true })\n\n    filteredInstances.forEach((instance, index) => {\n      const browser = instance.browser\n      if (!browser) {\n        const nth = index + 1\n        const ending = nth === 2 ? 'nd' : nth === 3 ? 'rd' : 'th'\n        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.`)\n      }\n      const name = instance.name\n      if (name == null) {\n        throw new Error(`The browser configuration must have a \"name\" property. This is a bug in Vitest. Please, open a new issue with reproduction`)\n      }\n      if (instance.provider?.name != null && projectConfig.browser.provider?.name != null && instance.provider?.name !== projectConfig.browser.provider?.name) {\n        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.`)\n      }\n\n      const provider = instance.provider?.name ?? projectConfig.browser.provider?.name ?? 'preview'\n\n      // Browser-mode CDP only features:\n      if (provider === 'preview' || !isChromiumName(provider, browser)) {\n        const browserConfig = `\n{\n  browser: {\n    provider: ${provider}(),\n    instances: [\n      ${(filteredInstances || []).map(i => `{ browser: '${i.browser}' }`).join(',\\n      ')}\n    ],\n  },\n}","sourceCodeStart":668,"sourceCodeEnd":704,"githubUrl":"https://github.com/vitest-dev/vitest/blob/d568f8ce3739b532d5bf2c1ee1e45e8a8a473d09/packages/vitest/src/node/projects/resolveProjects.ts#L668-L704","documentation":"After verifying the browser field, the expander (resolveProjects.ts:684-687) checks that instance.name is non-null. Name auto-resolution should always produce a name (it falls back to the browser engine), so a null name indicates a bug in Vitest's own resolution rather than a user config error. The message explicitly asks the user to file an issue with a reproduction.","triggerScenarios":"A code path where resolveProjectName / instance normalization returns null or undefined for a browser instance; an internal mutation that deletes instance.name before expansion; type drift where instance.name is typed string but runtime is null.","commonSituations":"Almost never seen in practice; if hit, it's typically after upgrading Vitest across a major version where the instance shape changed, or when a third-party plugin mutates browser.instances.","solutions":["Set an explicit `name` on every browser instance to bypass the auto-resolution path.","Upgrade or downgrade Vitest to a version where the bug is fixed; check the issue tracker with the message.","File a Vitest issue with the minimal config that reproduces it, as the message requests.","Audit any plugins that touch config.test.browser.instances for mutations that null out name."],"exampleFix":"// workaround: always set name explicitly\ntest: { browser: { enabled: true, provider: 'playwright', instances: [\n  { browser: 'chromium', name: 'chromium' },\n] } }","handlingStrategy":"validation","validationCode":"for (const inst of config.browser.instances) {\n  if (inst.name == null) inst.name = inst.browser // force a name to bypass the buggy path\n}","typeGuard":"function instanceHasName(inst: unknown): inst is { name: string } {\n  return !!inst && typeof (inst as any).name === 'string'\n}","tryCatchPattern":null,"preventionTips":["Always set an explicit `name` on every browser instance.","Pin Vitest to a known-good version; report reproducible occurrences upstream.","Audit plugins that touch browser.instances for mutations."],"tags":["browser","instances","internal-bug","naming"],"analyzedSha":"d568f8ce3739b532d5bf2c1ee1e45e8a8a473d09","analyzedAt":"2026-08-03T20:23:56.861Z","schemaVersion":2}