{"record":{"id":"0b4d26899d30309f","repo":"vitest-dev/vitest","slug":"browser-instances-was-set-in-the-config-but-the","errorCode":null,"errorMessage":"\"browser.instances\" was set in the config, but the array is empty. Define at least one browser config. The \"browser.name\" was set to \"${browser.name}\" which filtered all configs (${instances.map(c => c.browser).join(', ')}). Did you mean to use another name?","messagePattern":"\"browser\\.instances\" was set in the config, but the array is empty\\. Define at least one browser config\\. The \"browser\\.name\" was set to \"(.+?)\" which filtered all configs \\((.+?)\\)\\. Did you mean to use another name\\?","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/vitest/src/node/config/resolveConfig.ts","lineNumber":465,"sourceCode":"      )\n    }\n    browser.provider ??= browser.instances.find(instance => instance.provider)?.provider\n\n    // use `chromium` by default when the preview provider is specified\n    // for a smoother experience. if chromium is not available, it will\n    // open the default browser anyway\n    if (!browser.instances.length && browser.provider?.name === 'preview') {\n      browser.instances = [{ browser: 'chromium' }]\n    }\n\n    if (browser.name && instances?.length) {\n      // --browser=chromium filters configs to a single one\n      browser.instances = browser.instances.filter(instance => instance.browser === browser.name)\n\n      // if `instances` were defined, but now they are empty,\n      // let's throw an error because the filter is invalid\n      if (!browser.instances.length) {\n        throw new Error([\n          `\"browser.instances\" was set in the config, but the array is empty. Define at least one browser config.`,\n          ` The \"browser.name\" was set to \"${browser.name}\" which filtered all configs (${instances.map(c => c.browser).join(', ')}). Did you mean to use another name?`,\n        ].join(''))\n      }\n    }\n\n    browser.instances.forEach((instance) => {\n      instance.name ??= resolved.name\n        ? `${resolved.name} (${instance.browser})`\n        : instance.browser\n    })\n  }\n\n  if (resolved.coverage.enabled && resolved.coverage.provider === 'istanbul' && resolved.experimental?.viteModuleRunner === false) {\n    throw new Error(`\"Istanbul\" coverage provider is not compatible with \"experimental.viteModuleRunner: false\". Please, enable \"viteModuleRunner\" or switch to \"v8\" coverage provider.`)\n  }\n\n  if (browser.enabled && resolved.detectAsyncLeaks) {","sourceCodeStart":447,"sourceCodeEnd":483,"githubUrl":"https://github.com/vitest-dev/vitest/blob/1fa9837ec26533512fdcad8baebf249771bd340a/packages/vitest/src/node/config/resolveConfig.ts#L447-L483","documentation":"When `--browser=chromium` (or `browser.name`) is supplied, Vitest filters the configured `browser.instances` down to those whose `browser` field matches that name. If the filter removes every instance, the config is left with an empty array, which is almost always a typo. Vitest names the requested browser and lists the originally-configured browser values so the mismatch is obvious.","triggerScenarios":"`browser.instances: [{ browser: 'chromium' }]` combined with `--browser=firefox`; or a CLI override `--browser chrome` that does not match the canonical `'chromium'` string.","commonSituations":"CLI shorthand using a vendor name (`chrome`, `ff`) that does not match Playwright's canonical engine name; an instance list filtered against a stale `browser.name`.","solutions":["Use the canonical engine name (`chromium`, `firefox`, `webkit`) on both the instance and the filter.","Add an instance whose `browser` matches the requested name.","Drop `--browser=...` if you want to run every configured instance."],"exampleFix":"# before\nvitest --browser=firefox  # but only chromium is configured\n# after\nvitest --browser=chromium\n# or extend config\nbrowser: { instances: [{ browser: 'chromium' }, { browser: 'firefox' }] }","handlingStrategy":"validation","validationCode":"const instances = [{ browser: 'chromium' }, { browser: 'firefox' }]\nconst requested = process.env.BROWSER // e.g. 'firefox'\nif (requested && !instances.some(i => i.browser === requested)) {\n  throw new Error(`--browser=${requested} matches none of ${instances.map(i => i.browser).join(', ')}`)\n}","typeGuard":"function isKnownBrowserName(name: string): name is 'chromium' | 'firefox' | 'webkit' {\n  return name === 'chromium' || name === 'firefox' || name === 'webkit'\n}","tryCatchPattern":null,"preventionTips":["Use Playwright's canonical engine names everywhere (no `chrome`, `ff`).","Validate the `--browser` CLI value against the configured instances before invoking vitest."],"tags":["config","browser","cli","validation"],"backgroundTag":null,"analyzedSha":"1fa9837ec26533512fdcad8baebf249771bd340a","analyzedAt":"2026-08-11T16:11:39.638Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}