{"record":{"id":"925b601233d6f85b","repo":"vercel/next.js","slug":"only-custom-servers-can-pass-webpack-turbo-o","errorCode":null,"errorMessage":"Only custom servers can pass `webpack`, `turbo`, or `turbopack`.","messagePattern":"Only custom servers can pass `webpack`, `turbo`, or `turbopack`\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/next/src/server/next.ts","lineNumber":639,"sourceCode":"    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 &&\n    'version' in (options as any).typescript\n  ) {\n    const pluginMod: typeof import('./next-typescript') =\n      require('./next-typescript') as typeof import('./next-typescript')\n    return pluginMod.createTSPlugin(\n      options as any\n    ) as unknown as NextWrapperServer\n  }\n","sourceCodeStart":621,"sourceCodeEnd":657,"githubUrl":"https://github.com/vercel/next.js/blob/0eb377541648e63402a47b38fee00a8d0ce8f8f1/packages/next/src/server/next.ts#L621-L657","documentation":"Guard in createServer: bundler-selection options (webpack, turbo, turbopack) were passed, but the server being created is not a custom server (Next.js itself invoked the factory with customServer falsy). Those options only make sense when a user wires up their own HTTP server, so passing them here is a usage error.","triggerScenarios":"Bundler options are passed from a non-custom-server context.","commonSituations":"Passing webpack/turbopack options when not using a custom server.","solutions":["Only pass bundler options when using a custom server (dev: false custom setup)."],"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"}