{"record":{"id":"82ddd87321d2d7b6","repo":"vercel/next.js","slug":"config-options-experimental-proxyclientmaxbodysiz","errorCode":null,"errorMessage":"Config options `experimental.proxyClientMaxBodySize` and `experimental.middlewareClientMaxBodySize` cannot be set at the same time. Please use `experimental.proxyClientMaxBodySize` instead.","messagePattern":"Config options `experimental\\.proxyClientMaxBodySize` and `experimental\\.middlewareClientMaxBodySize` cannot be set at the same time\\. Please use `experimental\\.proxyClientMaxBodySize` instead\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/next/src/server/config.ts","lineNumber":976,"sourceCode":"    if (typeof bodySizeLimit === 'number') {\n      value = bodySizeLimit\n    } else {\n      value = bytes.parse(bodySizeLimit)\n    }\n\n    if (value === null || isNaN(value) || value < 1) {\n      throw new Error(\n        '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'\n      )\n    }\n  }\n\n  // Throw if both Middleware and Proxy config are set.\n  if (\n    userConfig.experimental?.proxyClientMaxBodySize !== undefined &&\n    userConfig.experimental?.middlewareClientMaxBodySize !== undefined\n  ) {\n    throw new Error(\n      'Config options `experimental.proxyClientMaxBodySize` and `experimental.middlewareClientMaxBodySize` cannot be set at the same time. Please use `experimental.proxyClientMaxBodySize` instead.'\n    )\n  }\n  if (\n    userConfig.experimental?.proxyPrefetch !== undefined &&\n    userConfig.experimental?.middlewarePrefetch !== undefined\n  ) {\n    throw new Error(\n      'Config options `experimental.proxyPrefetch` and `experimental.middlewarePrefetch` cannot be set at the same time. Please use `experimental.proxyPrefetch` instead.'\n    )\n  }\n  if (\n    userConfig.experimental?.externalProxyRewritesResolve !== undefined &&\n    userConfig.experimental?.externalMiddlewareRewritesResolve !== undefined\n  ) {\n    throw new Error(\n      'Config options `experimental.externalProxyRewritesResolve` and `experimental.externalMiddlewareRewritesResolve` cannot be set at the same time. Please use `experimental.externalProxyRewritesResolve` instead.'\n    )","sourceCodeStart":958,"sourceCodeEnd":994,"githubUrl":"https://github.com/vercel/next.js/blob/0ae8c72462952df163f1b1e0726641bc5b40dc93/packages/next/src/server/config.ts#L958-L994","documentation":"This version of Next.js aliases the older `experimental.middlewareClientMaxBodySize` to the newer `experimental.proxyClientMaxBodySize` (proxy is the renamed middleware layer). The check at config.ts:971-979 forbids setting both at once because the aliasing logic would otherwise conflict over which value wins. Only one source of truth is allowed.","triggerScenarios":"Setting both `experimental.proxyClientMaxBodySize` and `experimental.middlewareClientMaxBodySize` to any value (including undefined check is `!== undefined`, so explicitly setting either triggers it).","commonSituations":"Upgrading Next.js and partially migrating config (added the new key without removing the old one). Copying a config snippet that uses the old name into a project that already uses the new name.","solutions":["Remove `experimental.middlewareClientMaxBodySize` and keep only `experimental.proxyClientMaxBodySize`.","Confirm the value is correct for your deployment (it caps the body size of proxied client requests).","Re-run the build to ensure no other alias conflicts remain."],"exampleFix":"// before\nmodule.exports = { experimental: { proxyClientMaxBodySize: '5mb', middlewareClientMaxBodySize: '5mb' } }\n// after\nmodule.exports = { experimental: { proxyClientMaxBodySize: '5mb' } }","handlingStrategy":"validation","validationCode":"const e = config.experimental ?? {};\nif (e.proxyClientMaxBodySize !== undefined && e.middlewareClientMaxBodySize !== undefined) {\n  throw new Error('set only experimental.proxyClientMaxBodySize');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["During upgrades, grep config for `middlewareClientMaxBodySize` and remove it.","Keep a migration checklist of renamed experimental keys."],"tags":["config","proxy","middleware","migration","next-config"],"analyzedSha":"0ae8c72462952df163f1b1e0726641bc5b40dc93","analyzedAt":"2026-08-06T19:44:29.143Z","schemaVersion":2},"datasetVersion":"2026-08-07T02:17:10.218Z"}