{"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":345,"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":327,"sourceCodeEnd":363,"githubUrl":"https://github.com/vitest-dev/vitest/blob/d568f8ce3739b532d5bf2c1ee1e45e8a8a473d09/packages/vitest/src/node/config/resolveConfig.ts#L327-L363","documentation":"Standalone mode keeps Vitest's server alive so other tools (e.g. an editor) can attach and trigger runs; it is meaningless without watch because there would be no re-run trigger and the process would just exit. The guard at resolveConfig.ts:344 forces --watch whenever --standalone is set.","triggerScenarios":"Run `vitest --standalone` without --watch, or set `standalone: true` while `watch: false`.","commonSituations":"Trying standalone in a CI one-shot context; editor integration that forgot to enable watch.","solutions":["Always pair standalone with watch: `vitest --standalone --watch`.","If you do not need a persistent server, drop --standalone and run vitest normally.","Configure your editor plugin to pass both flags."],"exampleFix":"# before\nvitest --standalone\n# after\nvitest --standalone --watch","handlingStrategy":"validation","validationCode":"function assertStandaloneHasWatch(opts: { standalone?: boolean; watch?: boolean }) {\n  if (opts.standalone && !opts.watch) throw new Error('--standalone requires --watch')\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass --watch with --standalone.","Configure editor integrations to set both flags.","Do not use standalone in CI one-shot pipelines."],"tags":["cli","standalone","watch","editor-integration"],"analyzedSha":"d568f8ce3739b532d5bf2c1ee1e45e8a8a473d09","analyzedAt":"2026-08-03T20:23:56.861Z","schemaVersion":2}