{"record":{"id":"1848b3f2ad775ad3","repo":"vitest-dev/vitest","slug":"vitest-standalone-mode-requires-watch","errorCode":null,"errorMessage":"Vitest standalone mode requires --watch","messagePattern":"Vitest standalone mode requires --watch","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/vitest/src/node/config/resolveConfig.ts","lineNumber":373,"sourceCode":"    const [indexString, countString] = options.shard.split('/')\n    const index = Math.abs(Number.parseInt(indexString, 10))\n    const count = Math.abs(Number.parseInt(countString, 10))\n\n    if (Number.isNaN(count) || count <= 0) {\n      throw new Error('--shard <count> must be a positive number')\n    }\n\n    if (Number.isNaN(index) || index <= 0 || index > count) {\n      throw new Error(\n        '--shard <index> must be a positive number less then <count>',\n      )\n    }\n\n    resolved.shard = { index, count }\n  }\n\n  if (resolved.standalone && !resolved.watch) {\n    throw new Error(`Vitest standalone mode requires --watch`)\n  }\n\n  if (resolved.mergeReports && resolved.watch) {\n    throw new Error(`Cannot merge reports with --watch enabled`)\n  }\n\n  if (resolved.maxWorkers) {\n    resolved.maxWorkers = resolveInlineWorkerOption(resolved.maxWorkers)\n  }\n\n  // `browser.fileParallelism` was replaced by the top-level `fileParallelism`. Map\n  // it (only when browser is enabled, since it was a browser-only option) so\n  // existing configs keep working instead of being silently ignored.\n  const browserOptions = options.browser as { enabled?: boolean; fileParallelism?: boolean } | undefined\n  const browserFileParallelism = browserOptions?.enabled ? browserOptions.fileParallelism : undefined\n  if (browserFileParallelism !== undefined) {\n    logger.deprecate('`browser.fileParallelism` is deprecated. Use the top-level `fileParallelism` option instead.')\n  }","sourceCodeStart":355,"sourceCodeEnd":391,"githubUrl":"https://github.com/vitest-dev/vitest/blob/1fa9837ec26533512fdcad8baebf249771bd340a/packages/vitest/src/node/config/resolveConfig.ts#L355-L391","documentation":"Standalone mode (`--standalone`) starts Vitest without an initial test run and keeps the Vite server warm so subsequent invocations reuse it. It only makes sense paired with `--watch`, otherwise the server would start and immediately exit. Vitest rejects the combination of standalone + no-watch up front.","triggerScenarios":"Running `vitest --standalone` without `--watch`, or setting `standalone: true` while `watch: false` in config.","commonSituations":"Wrapping `--standalone` in a dev script that separately sets `watch: false`; a config default that forces `watch: false`.","solutions":["Add `--watch` (or set `watch: true`) when using `--standalone`.","Drop `--standalone` if you want a one-shot run.","Check that a `watch: false` default in config is not overriding the CLI flag."],"exampleFix":"# before\nvitest --standalone\n# after\nvitest --standalone --watch","handlingStrategy":"validation","validationCode":"const standalone = process.argv.includes('--standalone')\nconst watch = process.argv.includes('--watch')\nif (standalone && !watch) {\n  throw new Error('--standalone requires --watch; add it or drop --standalone.')\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Wrap `--standalone` in a dedicated npm script that always co-adds `--watch`.","Document the pairing in the script's help text."],"tags":["cli","standalone","watch"],"backgroundTag":null,"analyzedSha":"1fa9837ec26533512fdcad8baebf249771bd340a","analyzedAt":"2026-08-11T16:11:39.638Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}