{"record":{"id":"fb07d81feec8ec2b","repo":"vitest-dev/vitest","slug":"inspectoption-does-not-work-with-browserconfi","errorCode":null,"errorMessage":"${inspectOption} does not work with\n${browserConfig}\n\nUse either:\n${correctExample}\n\n...or disable ${inspectOption}\n","messagePattern":"(.+?) does not work with\n(.+?)\n\nUse either:\n(.+?)\n\n\\.\\.\\.or disable (.+?)\n","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/vitest/src/node/projects/resolveProjects.ts","lineNumber":937,"sourceCode":"          const coverageExample = `\n{\n  coverage: {\n    provider: 'istanbul',\n  },\n}\n            `.trim()\n\n          throw new Error(\n            `@vitest/coverage-v8 does not work with\\n${browserConfig}\\n`\n            + `\\nUse either:\\n${correctExample}`\n            + `\\n\\n...or change your coverage provider to:\\n${coverageExample}\\n`,\n          )\n        }\n\n        if (globalConfig.inspect || globalConfig.inspectBrk) {\n          const inspectOption = `--inspect${globalConfig.inspectBrk ? '-brk' : ''}`\n\n          throw new Error(\n            `${inspectOption} does not work with\\n${browserConfig}\\n`\n            + `\\nUse either:\\n${correctExample}`\n            + `\\n\\n...or disable ${inspectOption}\\n`,\n          )\n        }\n      }\n\n      if (names.has(name)) {\n        throw new Error(\n          [\n            `Cannot define a nested project for a ${browser} browser. The project name \"${name}\" was already defined. `,\n            'If you have multiple instances for the same browser, make sure to define a custom \"name\". ',\n            'All projects should have unique names. Make sure your configuration is correct.',\n          ].join(''),\n        )\n      }\n      names.add(name)\n","sourceCodeStart":919,"sourceCodeEnd":955,"githubUrl":"https://github.com/vitest-dev/vitest/blob/1fa9837ec26533512fdcad8baebf249771bd340a/packages/vitest/src/node/projects/resolveProjects.ts#L919-L955","documentation":"`--inspect`/`--inspect-brk` start Node's V8 inspector on the main/server process. In browser mode with the `preview` provider or a non-Chromium browser, the actual test code runs inside the browser, so the Node inspector cannot reach it and the debug session would be a silent no-op. Vitest refuses to start and points you at either a Chromium-based browser config (which supports CDP debugging) or disabling the flag.","triggerScenarios":"`globalConfig.inspect === true` OR `globalConfig.inspectBrk === true`, while resolving a browser instance that falls into the CDP-only branch (`provider === 'preview'` or `!isChromiumName(provider, browser)`). `inspectOption` is rendered as `--inspect` or `--inspect-brk`.","commonSituations":"Running `vitest --inspect` while a browser project is configured with the preview provider or playwright firefox/webkit; defaulting `inspectBrk` in a launch config shared with browser projects.","solutions":["Drop `--inspect`/`--inspect-brk` from the Vitest invocation when running browser tests.","Or switch the browser instance to a Chromium-based provider/browser (`playwright`+`chromium`, or `webdriverio`+`chrome`/`edge`) so CDP debugging applies.","Split Node and browser projects so the inspect flag only applies to the Node project."],"exampleFix":"// before: vitest --inspect --project=browser-firefox\n// browser: { provider: 'playwright', instances: [{ browser: 'firefox' }] }\n\n// after: run the browser project without inspect\n//   vitest --project=browser-firefox\n// and only inspect Node projects:\n//   vitest --inspect --project=node-core","handlingStrategy":"validation","validationCode":"// Don't pass --inspect to a browser project that can't use it.\nfunction assertInspectBrowserCompatible(globalConfig: { inspect?: boolean; inspectBrk?: boolean }, test: { browser?: any }) {\n  const inspecting = globalConfig.inspect || globalConfig.inspectBrk\n  if (!inspecting) return\n  const instances = test.browser?.instances ?? []\n  for (const i of instances) {\n    const provider = i.provider?.name ?? test.browser?.provider?.name ?? 'preview'\n    const chromium =\n      provider === 'playwright' ? i.browser === 'chromium'\n      : provider === 'webdriverio' ? (i.browser === 'chrome' || i.browser === 'edge')\n      : false\n    if (provider === 'preview' || !chromium) {\n      throw new Error(`--inspect is incompatible with non-Chromium browser instance '${i.browser}'. Drop the flag or switch to chromium.`)\n    }\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Scope `--inspect` to Node-only projects via `--project` selection.","Keep browser projects on Chromium targets when you need to debug them (use CDP/DevTools instead of `--inspect`)."],"tags":["browser","debugging","config"],"backgroundTag":null,"analyzedSha":"1fa9837ec26533512fdcad8baebf249771bd340a","analyzedAt":"2026-08-11T16:11:39.638Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}