vercel/next.js · error

Pass either `webpack` or `turbopack`, not both.

Error message

Pass either `webpack` or `turbopack`, not both.

What it means

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.

Solutions

  1. Pass only one of webpack or turbopack to the Next.js server options.
Defensive patterns

Strategy: validation

When it happens

Trigger: Both webpack and turbopack options are passed to the server.

Common situations: A custom server passes both bundler options to next(); pass only one.


AI-assisted analysis of vercel/next.js@0eb3775416 (2026-08-19). Data as JSON: /api/errors/e9cf2cbf8236fba9. Report an issue: GitHub.

Appendix: source

Thrown at packages/next/src/server/next.ts:630

}

// This file is used for when users run `require('next')`
function createServer(
  options: NextServerOptions & NextBundlerOptions
): NextWrapperServer {
  // next sets customServer to false when calling this function, in that case we don't want to modify the environment variables
  const isCustomServer = options?.customServer ?? true
  if (isCustomServer) {
    const selectTurbopack =
      options &&
      (options.turbo || options.turbopack || process.env.IS_TURBOPACK_TEST)
    const selectWebpack =
      options && (options.webpack || process.env.IS_WEBPACK_TEST)
    // Rspack is selected through env/config side effects instead of a custom
    // server option, so don't fall back to the default Turbopack auto mode.
    const selectRspack = !!process.env.NEXT_RSPACK
    if (selectTurbopack && selectWebpack && selectRspack) {
      throw new Error('Pass either `webpack` or `turbopack`, not both.')
    }
    if (selectTurbopack) {
      process.env.TURBOPACK ??= '1'
    } else if (!selectWebpack && !selectRspack) {
      process.env.TURBOPACK ??= 'auto'
    }
  } else {
    if (options && (options.webpack || options.turbo || options.turbopack)) {
      throw new Error(
        'Only custom servers can pass `webpack`, `turbo`, or `turbopack`.'
      )
    }
  }

  // The package is used as a TypeScript plugin.
  if (
    options &&
    'typescript' in options &&

View on GitHub (pinned to 0eb3775416)