{"record":{"id":"e9cf2cbf8236fba9","repo":"vercel/next.js","slug":"pass-either-webpack-or-turbopack-not-both","errorCode":null,"errorMessage":"Pass either `webpack` or `turbopack`, not both.","messagePattern":"Pass either `webpack` or `turbopack`, not both\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/next/src/server/next.ts","lineNumber":630,"sourceCode":"}\n\n// This file is used for when users run `require('next')`\nfunction createServer(\n  options: NextServerOptions & NextBundlerOptions\n): NextWrapperServer {\n  // next sets customServer to false when calling this function, in that case we don't want to modify the environment variables\n  const isCustomServer = options?.customServer ?? true\n  if (isCustomServer) {\n    const selectTurbopack =\n      options &&\n      (options.turbo || options.turbopack || process.env.IS_TURBOPACK_TEST)\n    const selectWebpack =\n      options && (options.webpack || process.env.IS_WEBPACK_TEST)\n    // Rspack is selected through env/config side effects instead of a custom\n    // server option, so don't fall back to the default Turbopack auto mode.\n    const selectRspack = !!process.env.NEXT_RSPACK\n    if (selectTurbopack && selectWebpack && selectRspack) {\n      throw new Error('Pass either `webpack` or `turbopack`, not both.')\n    }\n    if (selectTurbopack) {\n      process.env.TURBOPACK ??= '1'\n    } else if (!selectWebpack && !selectRspack) {\n      process.env.TURBOPACK ??= 'auto'\n    }\n  } else {\n    if (options && (options.webpack || options.turbo || options.turbopack)) {\n      throw new Error(\n        'Only custom servers can pass `webpack`, `turbo`, or `turbopack`.'\n      )\n    }\n  }\n\n  // The package is used as a TypeScript plugin.\n  if (\n    options &&\n    'typescript' in options &&","sourceCodeStart":612,"sourceCodeEnd":648,"githubUrl":"https://github.com/vercel/next.js/blob/0eb377541648e63402a47b38fee00a8d0ce8f8f1/packages/next/src/server/next.ts#L612-L648","documentation":"Option conflict in createServer for custom servers: bundler-selection inputs resolved to both Turbopack and webpack simultaneously (options.turbo/turbopack or IS_TURBOPACK_TEST together with options.webpack or IS_WEBPACK_TEST). Exactly one bundler can be forced, so the combination is rejected up front.","triggerScenarios":"Both webpack and turbopack options are passed to the server.","commonSituations":"A custom server passes both bundler options to next(); pass only one.","solutions":["Pass only one of webpack or turbopack to the Next.js server options."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0eb377541648e63402a47b38fee00a8d0ce8f8f1","analyzedAt":"2026-08-19T02:10:13.922Z","contentChangedAt":"2026-08-19T02:10:13.922Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}