vercel/next.js · error

Request body exceeded ${bytes.format(bodySizeLimit)}${urlInf

Error message

Request body exceeded ${bytes.format(bodySizeLimit)}${urlInfo}. Only the first ${bytes.format(bodySizeLimit)} will be available unless configured. See https://nextjs.org/docs/app/api-reference/config/next-config-js/middlewareClientMaxBodySize for more details.

What it means

Error "Request body exceeded ${bytes.format(bodySizeLimit)}${urlInfo}. Only the first ${bytes.format(bodySizeLimit)} will be available unless configured. See https://nextjs.org/docs/app/api-reference/config/next-config-js/middlewareClientMaxBodySize for more details." thrown in vercel/next.js.

Source

Thrown at packages/next/src/server/body-streams.ts:101

      // `.push()`, it must be a plain Readable: a Duplex (PassThrough) would copy
      // its writable-side internals (`_writableState`, `write`, `end`, ...) onto the
      // IncomingMessage, making the request look like an unfinished writable stream
      // and hanging Node stream APIs such as `Readable.toWeb()`.
      const p2 = new Readable({ read() {} })

      let bytesRead = 0
      const bodySizeLimit = sizeLimit ?? DEFAULT_BODY_CLONE_SIZE_LIMIT
      let limitExceeded = false

      input.on('data', (chunk) => {
        if (limitExceeded) return

        bytesRead += chunk.length

        if (bytesRead > bodySizeLimit) {
          limitExceeded = true
          const urlInfo = readable.url ? ` for ${readable.url}` : ''
          console.warn(
            // TODO(jiwon): Update this document link
            `Request body exceeded ${bytes.format(bodySizeLimit)}${urlInfo}. Only the first ${bytes.format(bodySizeLimit)} will be available unless configured. See https://nextjs.org/docs/app/api-reference/config/next-config-js/middlewareClientMaxBodySize for more details.`
          )
          p1.push(null)
          p2.push(null)
          return
        }

        p1.push(chunk)
        p2.push(chunk)
      })
      input.on('end', () => {
        if (!limitExceeded) {
          p1.push(null)
          p2.push(null)
        }
      })
      buffered = p2

View on GitHub (pinned to 0eb3775416)

Solutions

  1. Reduce the request body size, or increase `middlewareClientMaxBodySize` in next.config.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/next/src/server/body-streams.ts:101 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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