{"record":{"id":"65f41880358029e3","repo":"vercel/next.js","slug":"server-action-arguments-list-is-too-long-args-l","errorCode":null,"errorMessage":"Server Action arguments list is too long (${args.length}). Maximum allowed is ${SERVER_ACTION_ARGS_LIMIT}.","messagePattern":"Server Action arguments list is too long \\((.+?)\\)\\. Maximum allowed is (.+?)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/next/src/server/app-render/action-handler.ts","lineNumber":1392,"sourceCode":"const SERVER_ACTION_ARGS_LIMIT = 1000\n\nasync function executeActionAndPrepareForRender<\n  TFn extends (...args: any[]) => Promise<any>,\n>(\n  action: TFn,\n  args: Parameters<TFn>,\n  workStore: WorkStore,\n  requestStore: RequestStore,\n  actionWasForwarded: boolean\n): Promise<{\n  actionResult: Awaited<ReturnType<TFn>>\n  skipPageRendering: boolean\n}> {\n  requestStore.phase = 'action'\n  let skipPageRendering = actionWasForwarded\n\n  if (args.length > SERVER_ACTION_ARGS_LIMIT) {\n    throw new Error(\n      `Server Action arguments list is too long (${args.length}). Maximum allowed is ${SERVER_ACTION_ARGS_LIMIT}.`\n    )\n  }\n\n  try {\n    const actionResult = await workUnitAsyncStorage.run(requestStore, () =>\n      action.apply(null, args)\n    )\n\n    // If the page was not revalidated, or if the action was forwarded from\n    // another worker, we can skip rendering the page.\n    skipPageRendering ||=\n      workStore.pathWasRevalidated === undefined ||\n      workStore.pathWasRevalidated === ActionDidNotRevalidate\n\n    return { actionResult, skipPageRendering }\n  } finally {\n    if (!skipPageRendering) {","sourceCodeStart":1374,"sourceCodeEnd":1410,"githubUrl":"https://github.com/vercel/next.js/blob/0ae8c72462952df163f1b1e0726641bc5b40dc93/packages/next/src/server/app-render/action-handler.ts#L1374-L1410","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Do not pass more than 1000 positional arguments; bundle the data into a single array/object argument instead of spreading.","If you need to process a large collection, pass it as one argument and iterate server-side.","Validate/limit the size of user-provided arrays on the client before calling the action.","Restructure the action signature to take a single payload object rather than many args."],"exampleFix":"// before\n// await action(...thousandsOfItems)\n\n// after\n// await action({ items: thousandsOfItems })","handlingStrategy":"validation","validationCode":"// Validate argument count client-side before calling the action.\nconst LIMIT = 1000\nfunction callAction(fn, args) {\n  if (args.length > LIMIT) throw new Error(`Too many arguments (max ${LIMIT})`)\n  return fn(...args)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never spread unbounded arrays into an action; pass them as a single argument.","Cap user-provided collection sizes before invoking actions.","Design action signatures to accept a single payload object/array.","Document the 1000-arg limit in your action usage."],"tags":["server-actions","arguments","limits","stack-overflow"],"analyzedSha":"0ae8c72462952df163f1b1e0726641bc5b40dc93","analyzedAt":"2026-08-06T19:44:29.143Z","schemaVersion":2},"datasetVersion":"2026-08-07T02:17:10.218Z"}