vercel/next.js · error · Error

Server Action arguments list is too long (${args.length}). M

Error message

Server Action arguments list is too long (${args.length}). Maximum allowed is ${SERVER_ACTION_ARGS_LIMIT}.

What it means

A hard guard in executeActionAndPrepareForRender() that rejects before invoking action.apply(null, args) when args.length exceeds SERVER_ACTION_ARGS_LIMIT (1000). It exists to prevent stack overflow from maliciously or accidentally huge argument arrays passed to a Server Action. The limit is a fixed constant, not configurable.

Source

Thrown at packages/next/src/server/app-render/action-handler.ts:1392

const SERVER_ACTION_ARGS_LIMIT = 1000

async function executeActionAndPrepareForRender<
  TFn extends (...args: any[]) => Promise<any>,
>(
  action: TFn,
  args: Parameters<TFn>,
  workStore: WorkStore,
  requestStore: RequestStore,
  actionWasForwarded: boolean
): Promise<{
  actionResult: Awaited<ReturnType<TFn>>
  skipPageRendering: boolean
}> {
  requestStore.phase = 'action'
  let skipPageRendering = actionWasForwarded

  if (args.length > SERVER_ACTION_ARGS_LIMIT) {
    throw new Error(
      `Server Action arguments list is too long (${args.length}). Maximum allowed is ${SERVER_ACTION_ARGS_LIMIT}.`
    )
  }

  try {
    const actionResult = await workUnitAsyncStorage.run(requestStore, () =>
      action.apply(null, args)
    )

    // If the page was not revalidated, or if the action was forwarded from
    // another worker, we can skip rendering the page.
    skipPageRendering ||=
      workStore.pathWasRevalidated === undefined ||
      workStore.pathWasRevalidated === ActionDidNotRevalidate

    return { actionResult, skipPageRendering }
  } finally {
    if (!skipPageRendering) {

View on GitHub (pinned to 0ae8c72462)

Solutions

  1. Do not pass more than 1000 positional arguments; bundle the data into a single array/object argument instead of spreading.
  2. If you need to process a large collection, pass it as one argument and iterate server-side.
  3. Validate/limit the size of user-provided arrays on the client before calling the action.
  4. Restructure the action signature to take a single payload object rather than many args.

Example fix

// before
// await action(...thousandsOfItems)

// after
// await action({ items: thousandsOfItems })
Defensive patterns

Strategy: validation

Validate before calling

// Validate argument count client-side before calling the action.
const LIMIT = 1000
function callAction(fn, args) {
  if (args.length > LIMIT) throw new Error(`Too many arguments (max ${LIMIT})`)
  return fn(...args)
}

Prevention

When it happens

Trigger: A Server Action is invoked (fetch or MPA) whose decoded arguments array has more than 1000 entries. executeActionAndPrepareForRender checks args.length first and throws before running the action.

Common situations: A developer spreads a very large array into an action call (e.g. action(...bigArray)); a client constructs a reply payload with thousands of elements; an adversarial request crafted to overflow the stack. Rarely hit in normal use.

Related errors


AI-assisted analysis of vercel/next.js@0ae8c72462 (2026-08-06). Data as JSON: /api/errors/65f41880358029e3. Report an issue: GitHub.