{"record":{"id":"b3b6dcd12ad58c09","repo":"cypress-io/cypress","slug":"err","errorCode":null,"errorMessage":"${err}","messagePattern":"\\$\\{err\\}","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"npm/vite-dev-server/src/devServer.ts","lineNumber":119,"sourceCode":"devServer.create = async function createDevServer (devServerConfig: ViteDevServerConfig, vite: Vite_7 | Vite_8) {\n  try {\n    // Handling here is mainly for conditional generics to make sure we get the types correct between vite 7 and vite 8.\n    // Eventually, vite 8 will be the default and we can remove this logic\n    if (isVite8(vite)) {\n      const config = await createViteDevServerConfig<Vite_8>(devServerConfig, vite as Vite_8)\n\n      return await (vite as Vite_8).createServer(config)\n    }\n\n    const config = await createViteDevServerConfig<Vite_7>(devServerConfig, vite as Vite_7)\n\n    return await (vite as Vite_7).createServer(config)\n  } catch (err) {\n    if (err instanceof Error) {\n      throw err\n    }\n\n    throw new Error(err as string)\n  }\n}\n","sourceCodeStart":101,"sourceCodeEnd":122,"githubUrl":"https://github.com/cypress-io/cypress/blob/0d85fdc91230885bca0a91df278312800a48b727/npm/vite-dev-server/src/devServer.ts#L101-L122","documentation":"The catch-all in devServer.create: it wraps the createServer/createViteDevServerConfig phase. If the thrown value is already an Error it is rethrown unchanged; any non-Error value (string, object, plain rejection) is coerced via `new Error(err as string)`. So the surfaced message is whatever non-Error value the underlying Vite/config pipeline rejected with, stringified.","triggerScenarios":"Any failure inside vite.createServer(config) or createViteDevServerConfig — e.g. an invalid plugin, a config that throws a string, an ESM/CJS interop rejection, or a plugin that rejects with a plain object rather than an Error. The wrapper ensures Cypress always rethrows a real Error.","commonSituations":"A user Vite plugin that throws a string instead of an Error; a viteConfig function that returns an invalid shape; a config import that fails to resolve; version skew between installed Vite and a plugin expecting a different API.","solutions":["Inspect the embedded message — it is the raw stringified rejection from the Vite pipeline.","Reproduce the viteConfig outside Cypress with `vite` directly to isolate whether the fault is in your config or in Cypress's wrapping.","Ensure any custom Vite plugins throw real Errors (with stack traces), not strings, for diagnosable output.","Align your installed Vite major (5/6/7/8) with plugin compatibility."],"exampleFix":"// before: plugin throws a string\nconst myPlugin = () => ({ name: 'p', transform () { throw 'bad input' } })\n// after: throw a real Error\nconst myPlugin = () => ({ name: 'p', transform () { throw new Error('bad input') } })","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"const isRealError = (e: unknown): e is Error => e instanceof Error","tryCatchPattern":"try {\n  await devServer.create(devServerConfig, vite)\n} catch (err) {\n  const e = err instanceof Error ? err : new Error(String(err))\n  // log e, decide retry vs fail\n  throw e\n}","preventionTips":["Make custom Vite plugins throw real Errors with stack traces.","Validate viteConfig shape before passing to devServer.","Reproduce config failures with plain vite outside Cypress to isolate causes."],"tags":["vite","dev-server","error-wrapping","plugin"],"backgroundTag":null,"analyzedSha":"0d85fdc91230885bca0a91df278312800a48b727","analyzedAt":"2026-08-12T16:24:28.056Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}