{"id":"2c7721ee29728ebc","repo":"vitest-dev/vitest","slug":"you-cannot-use-inspectoption-without-no-file","errorCode":null,"errorMessage":"You cannot use ${inspectOption} without \"--no-file-parallelism\"","messagePattern":"You cannot use (.+?) without \"--no-file-parallelism\"","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/vitest/src/node/config/resolveConfig.ts","lineNumber":382,"sourceCode":"\n  const fileParallelism = options.fileParallelism ?? browserFileParallelism ?? true\n\n  if (!fileParallelism) {\n    // ignore user config, parallelism cannot be implemented without limiting workers\n    resolved.maxWorkers = 1\n  }\n\n  if (resolved.maxConcurrency === 0) {\n    logger.console.warn(\n      c.yellow(`The option \"maxConcurrency\" cannot be set to 0. Using default value ${configDefaults.maxConcurrency} instead.`),\n    )\n    resolved.maxConcurrency = configDefaults.maxConcurrency\n  }\n\n  if (resolved.inspect || resolved.inspectBrk) {\n    if (resolved.maxWorkers !== 1) {\n      const inspectOption = `--inspect${resolved.inspectBrk ? '-brk' : ''}`\n      throw new Error(\n        `You cannot use ${inspectOption} without \"--no-file-parallelism\"`,\n      )\n    }\n  }\n\n  resolved.browser ??= {} as any\n  const browser = resolved.browser\n\n  if (browser.enabled) {\n    const instances = browser.instances\n    if (!browser.instances) {\n      browser.instances = []\n    }\n\n    // The whole project shares a single browser Vite server, so every instance\n    // must use the same provider. Validate that here and hoist the provider to\n    // the project level so the cluster resolves one even when it is only set per\n    // instance (e.g. connect mode). Because the provider is uniform, any","sourceCodeStart":364,"sourceCodeEnd":400,"githubUrl":"https://github.com/vitest-dev/vitest/blob/d568f8ce3739b532d5bf2c1ee1e45e8a8a473d09/packages/vitest/src/node/config/resolveConfig.ts#L364-L400","documentation":"Node's inspector attaches to a single process; Vitest's file parallelism runs multiple worker threads/processes, so the debugger would either attach to the wrong one or none. The check at resolveConfig.ts:380 requires maxWorkers === 1 (i.e. --no-file-parallelism) when --inspect or --inspect-brk is used, ensuring the inspector hits the only worker running your tests.","triggerScenarios":"Run `vitest --inspect` without also passing `--no-file-parallelism`, or set `inspect: true` in config while fileParallelism stays default (true).","commonSituations":"Trying to debug a test with the inspector for the first time; forgetting that parallelism is on by default.","solutions":["Add --no-file-parallelism: `vitest --inspect --no-file-parallelism`.","Or set `fileParallelism: false` in config when debugging.","For --inspect-brk, also pair with --no-file-parallelism so the breakpoint halts the single worker."],"exampleFix":"# before\nvitest --inspect-brk\n# after\nvitest --inspect-brk --no-file-parallelism","handlingStrategy":"validation","validationCode":"function assertInspectNeedsSingleWorker(opts: { inspect?: boolean; inspectBrk?: boolean; fileParallelism?: boolean }) {\n  if ((opts.inspect || opts.inspectBrk) && opts.fileParallelism !== false) {\n    throw new Error('Pass --no-file-parallelism when using --inspect/--inspect-brk')\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pair --inspect with --no-file-parallelism always.","Add a debug npm script that sets both flags.","Remember the inspector attaches to a single process."],"tags":["cli","inspect","debugging","parallelism","worker-threads"],"analyzedSha":"d568f8ce3739b532d5bf2c1ee1e45e8a8a473d09","analyzedAt":"2026-08-03T20:23:56.861Z","schemaVersion":2}