vercel/next.js · error · Error

Server Actions Size Limit must be a valid number or…

Error message

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

What it means

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" thrown in vercel/next.js.

Solutions

  1. Set serverActions.bodySizeLimit to a number of bytes or a size string like '2mb' (must exceed 1MB).
Defensive patterns

Strategy: validation

When it happens

Trigger: serverActions.bodySizeLimit is not a valid number or filesize string.

Common situations: A malformed bodySizeLimit value such as 'abc' or a size under 1MB in next.config.


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

Appendix: source

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

    result.output = 'standalone'
  }

  if (
    typeof result.experimental?.serverActions?.bodySizeLimit !== 'undefined'
  ) {
    const bytes =
      require('next/dist/compiled/bytes') as typeof import('next/dist/compiled/bytes')
    const bodySizeLimit = result.experimental.serverActions.bodySizeLimit
    let value: number | null

    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
  ) {

View on GitHub (pinned to 34433fd12e)