{
  "id": "nextjs/server-action-body-size-exceeded",
  "signature": "Error: Server Action payload exceeds the maximum size limit (4MB).",
  "signature_zh": "错误：服务器操作负载超过最大大小限制（4MB）。",
  "regex": "Server Action payload exceeds the maximum size limit",
  "domain": "nextjs",
  "category": "data_error",
  "subcategory": null,
  "root_cause": "Server Actions have a default body size limit of 4MB; uploading large files or sending large FormData objects triggers this error.",
  "root_cause_type": "generic",
  "root_cause_zh": "服务器操作的默认主体大小限制为 4MB；上传大文件或发送大型 FormData 对象会触发此错误。",
  "versions": [
    {
      "version": "next@14.0.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "next@14.1.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "next@15.0.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "This works but may not be allowed in some hosting environments; also, it's a security risk if not carefully scoped.",
      "fail_rate": 0.4,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Server Actions expect FormData; compression breaks the form structure unless handled server-side.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "This adds complexity and may cause race conditions or partial failures without proper transaction handling.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Increase the body size limit for the specific server action route in next.config.js:\n\nexport default {\n  experimental: {\n    serverActions: {\n      bodySizeLimit: '10mb',\n    },\n  },\n};\n\nOr set it per action using the config export: export const config = { api: { bodyParser: { sizeLimit: '10mb' } } };",
      "success_rate": 0.85,
      "how": "Increase the body size limit for the specific server action route in next.config.js:\n\nexport default {\n  experimental: {\n    serverActions: {\n      bodySizeLimit: '10mb',\n    },\n  },\n};\n\nOr set it per action using the config export: export const config = { api: { bodyParser: { sizeLimit: '10mb' } } };",
      "condition": "",
      "sources": []
    },
    {
      "action": "Upload large files directly to a cloud storage service (e.g., S3) using a presigned URL, and only send the file reference to the server action.",
      "success_rate": 0.9,
      "how": "Upload large files directly to a cloud storage service (e.g., S3) using a presigned URL, and only send the file reference to the server action.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Implement chunked uploads client-side, sending parts of the file as separate server actions, then reassemble on the server.",
      "success_rate": 0.75,
      "how": "Implement chunked uploads client-side, sending parts of the file as separate server actions, then reassemble on the server.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "在 next.config.js 中增加特定服务器操作路由的主体大小限制：\n\nexport default {\n  experimental: {\n    serverActions: {\n      bodySizeLimit: '10mb',\n    },\n  },\n};\n\n或者使用配置导出为每个操作设置：export const config = { api: { bodyParser: { sizeLimit: '10mb' } } };",
    "使用预签名 URL 将大文件直接上传到云存储服务（例如 S3），只将文件引用发送到服务器操作。",
    "在客户端实现分块上传，将文件的一部分作为单独的服务器操作发送，然后在服务器上重新组装。"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://nextjs.org/docs/app/api-reference/functions/server-actions#size-limitation",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.82,
  "fix_success_rate": 0.8,
  "resolvable": "partial",
  "first_seen": "2024-01-10",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}