{"record":{"id":"f00a8277ad2f2921","repo":"vercel/next.js","slug":"client-max-body-size-must-be-larger-than-0-bytes","errorCode":null,"errorMessage":"Client Max Body Size must be larger than 0 bytes","messagePattern":"Client Max Body Size must be larger than 0 bytes","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/next/src/server/config.ts","lineNumber":1074,"sourceCode":"  // Normalize & validate experimental.proxyClientMaxBodySize\n  if (typeof result.experimental?.proxyClientMaxBodySize !== 'undefined') {\n    const proxyClientMaxBodySize = result.experimental.proxyClientMaxBodySize\n    let normalizedValue: number\n\n    if (typeof proxyClientMaxBodySize === 'string') {\n      const bytes =\n        require('next/dist/compiled/bytes') as typeof import('next/dist/compiled/bytes')\n      normalizedValue = bytes.parse(proxyClientMaxBodySize)\n    } else if (typeof proxyClientMaxBodySize === 'number') {\n      normalizedValue = proxyClientMaxBodySize\n    } else {\n      throw new Error(\n        'Client Max Body Size must be a valid number (bytes) or filesize format string (e.g., \"5mb\")'\n      )\n    }\n\n    if (isNaN(normalizedValue) || normalizedValue < 1) {\n      throw new Error('Client Max Body Size must be larger than 0 bytes')\n    }\n\n    // Store the normalized value as a number\n    result.experimental.proxyClientMaxBodySize = normalizedValue\n  }\n\n  warnOptionHasBeenMovedOutOfExperimental(\n    result,\n    'transpilePackages',\n    'transpilePackages',\n    configFileName,\n    silent\n  )\n  warnOptionHasBeenMovedOutOfExperimental(\n    result,\n    'skipMiddlewareUrlNormalize',\n    'skipMiddlewareUrlNormalize',\n    configFileName,","sourceCodeStart":1056,"sourceCodeEnd":1092,"githubUrl":"https://github.com/vercel/next.js/blob/0ae8c72462952df163f1b1e0726641bc5b40dc93/packages/next/src/server/config.ts#L1056-L1092","documentation":"After accepting the type, config.ts:1073-1075 checks that the parsed/numeric value is not NaN and is at least 1 byte. A value of 0, a negative number, or an unparseable string that `bytes.parse` turns into NaN triggers this. This enforces a sane floor before the value is stored as a normalized number.","triggerScenarios":"Setting `proxyClientMaxBodySize: 0`, `proxyClientMaxBodySize: -1`, or `proxyClientMaxBodySize: 'not-a-size'` (bytes.parse returns NaN).","commonSituations":"Using 0 intending 'no limit' (use a very large number or omit instead). Env var defaulting to '0'. Mis-typed unit that bytes.parse cannot read.","solutions":["Set a positive number of bytes or a recognized filesize string (`'5mb'`, `'1gb'`).","To effectively disable the cap, omit the option or use a large value.","Pre-validate strings with `require('bytes').parse(v)` and confirm it returns a finite positive number."],"exampleFix":"// before\nmodule.exports = { experimental: { proxyClientMaxBodySize: 0 } }\n// after\nmodule.exports = { experimental: { proxyClientMaxBodySize: '5mb' } }","handlingStrategy":"validation","validationCode":"const bytes = require('bytes');\nconst raw = config.experimental?.proxyClientMaxBodySize;\nif (raw !== undefined) {\n  const n = typeof raw === 'number' ? raw : bytes.parse(raw);\n  if (isNaN(n) || n < 1) throw new Error('proxyClientMaxBodySize must be > 0 bytes');\n}","typeGuard":"function isPositiveBytes(v: unknown): boolean {\n  const n = typeof v === 'number' ? v : typeof v === 'string' ? require('bytes').parse(v) : NaN;\n  return typeof n === 'number' && !isNaN(n) && n >= 1;\n}","tryCatchPattern":null,"preventionTips":["Do not use 0 to mean 'no limit'; omit the key instead.","Validate strings via bytes.parse in a scratch script."],"tags":["config","proxy","bodysizelimit","validation","next-config"],"analyzedSha":"0ae8c72462952df163f1b1e0726641bc5b40dc93","analyzedAt":"2026-08-06T19:44:29.143Z","schemaVersion":2},"datasetVersion":"2026-08-07T02:17:10.218Z"}