{"record":{"id":"c40a96e16d47e7c2","repo":"vitest-dev/vitest","slug":"the-browser-configuration-must-have-a-browser-pr","errorCode":null,"errorMessage":"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.","messagePattern":"The browser configuration must have a \"browser\" property\\. The (.+?)(.+?) item in \"browser\\.instances\" doesn't have it\\. Make sure your(.+?)\"` : ''\\} configuration is correct\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/vitest/src/node/projects/resolveProjects.ts","lineNumber":878,"sourceCode":"      ? instances\n      : instances.filter(instance => matchesProjectFilter(globalConfig.project, instance.name!))\n    if (!filteredInstances.length) {\n      continue\n    }\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: [","sourceCodeStart":860,"sourceCodeEnd":896,"githubUrl":"https://github.com/vitest-dev/vitest/blob/1fa9837ec26533512fdcad8baebf249771bd340a/packages/vitest/src/node/projects/resolveProjects.ts#L860-L896","documentation":"When expanding browser.instances, each instance must specify a 'browser' field. The loop computes an ordinal label (1st/2nd/3rd/Nth) and names the parent project if it has one, so the user can locate the offending instance entry in their config.","triggerScenarios":"A browser.instances array entry is missing the 'browser' property (e.g. only specifies name/provider), so instance.browser is falsy at expansion time.","commonSituations":"Typing 'browserName' instead of 'browser', omitting the field, or a copy-paste from a config that used a different key.","solutions":["Add the 'browser' field (e.g. 'chromium', 'firefox', 'webkit') to the indicated instance.","Use the ordinal in the error to find the exact instance in your config.","Validate every instances entry has a browser string before running."],"exampleFix":"// before\nbrowser: { instances: [{ name: 'chrome' /* no browser */ }] }\n// after\nbrowser: { instances: [{ name: 'chrome', browser: 'chromium' }] }","handlingStrategy":"type-guard","validationCode":"// Validate browser.instances entries before running.\nfunction validateInstances(instances: { browser?: string; name?: string }[]) {\n  instances.forEach((inst, i) => {\n  if (!inst.browser) throw new Error(`Instance #${i + 1} is missing required \"browser\" field`)\n  })\n}","typeGuard":"const isCompleteInstance = (inst: unknown): inst is { browser: string; name?: string } =>\n  typeof inst === 'object' && inst !== null && typeof (inst as any).browser === 'string'","tryCatchPattern":null,"preventionTips":["Always set 'browser' on every browser.instances entry.","Add a config schema/zod check for browser.instances in CI.","Use the documented keys exactly ('browser', 'name', 'provider')."],"tags":["browser","config","instances","validation"],"backgroundTag":null,"analyzedSha":"1fa9837ec26533512fdcad8baebf249771bd340a","analyzedAt":"2026-08-11T16:11:39.638Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}