vercel/next.js · error · Error

Config options `experimental.proxyClientMaxBodySize` and…

Error message

Config options `experimental.proxyClientMaxBodySize` and `experimental.middlewareClientMaxBodySize` cannot be set at the same time. Please use `experimental.proxyClientMaxBodySize` instead.

What it means

Error "Config options `experimental.proxyClientMaxBodySize` and `experimental.middlewareClientMaxBodySize` cannot be set at the same time. Please use `experimental.proxyClientMaxBodySize` instead." thrown in vercel/next.js.

Solutions

  1. Remove experimental.middlewareClientMaxBodySize and keep only experimental.proxyClientMaxBodySize.
Defensive patterns

Strategy: validation

When it happens

Trigger: Both proxyClientMaxBodySize and middlewareClientMaxBodySize are set.

Common situations: Migrating config that sets both the old middleware and new proxy body-size options.


AI-assisted analysis of vercel/next.js@34433fd12e (2026-08-19). Data as JSON: /api/errors/82ddd87321d2d7b6. Report an issue: GitHub.

Appendix: source

Thrown at packages/next/src/server/config.ts:1046

    if (typeof bodySizeLimit === 'number') {
      value = bodySizeLimit
    } else {
      value = bytes.parse(bodySizeLimit)
    }

    if (value === null || isNaN(value) || value < 1) {
      throw new Error(
        'Server Actions Size Limit must be a valid number or filesize format larger than 1MB: https://nextjs.org/docs/app/api-reference/next-config-js/serverActions#bodysizelimit'
      )
    }
  }

  // Throw if both Middleware and Proxy config are set.
  if (
    userConfig.experimental?.proxyClientMaxBodySize !== undefined &&
    userConfig.experimental?.middlewareClientMaxBodySize !== undefined
  ) {
    throw new Error(
      'Config options `experimental.proxyClientMaxBodySize` and `experimental.middlewareClientMaxBodySize` cannot be set at the same time. Please use `experimental.proxyClientMaxBodySize` instead.'
    )
  }
  if (
    userConfig.experimental?.proxyPrefetch !== undefined &&
    userConfig.experimental?.middlewarePrefetch !== undefined
  ) {
    throw new Error(
      'Config options `experimental.proxyPrefetch` and `experimental.middlewarePrefetch` cannot be set at the same time. Please use `experimental.proxyPrefetch` instead.'
    )
  }
  if (
    userConfig.experimental?.externalProxyRewritesResolve !== undefined &&
    userConfig.experimental?.externalMiddlewareRewritesResolve !== undefined
  ) {
    throw new Error(
      'Config options `experimental.externalProxyRewritesResolve` and `experimental.externalMiddlewareRewritesResolve` cannot be set at the same time. Please use `experimental.externalProxyRewritesResolve` instead.'
    )

View on GitHub (pinned to 34433fd12e)