{
  "id": "nextjs/server-action-formdata-undefined",
  "signature": "Error: Server Action failed. FormData is undefined or empty.",
  "signature_zh": "错误：服务器操作失败。FormData 未定义或为空。",
  "regex": "Error: Server Action failed\\. FormData is undefined or empty\\.",
  "domain": "nextjs",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "Server Action's FormData is undefined because the form was submitted without an event handler or the action prop is missing on the form element.",
  "root_cause_type": "generic",
  "root_cause_zh": "服务器操作的 FormData 未定义，因为表单提交时没有事件处理程序，或者表单元素上缺少 action 属性。",
  "versions": [
    {
      "version": "next@14.2.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"
    },
    {
      "version": "react@18.3.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "'use server' should be on the Server Action function, not the component file. This causes the form to not recognize the action as a server action.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Server Actions require the form action attribute to properly bind FormData. onClick bypasses this and sends undefined.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Server Actions cannot be called directly from client components without 'use server' on the action function. This leads to undefined FormData.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Ensure the form has an action prop pointing to the Server Action function, and the action is defined in a separate file or with 'use server' at the top of the action function.",
      "success_rate": 0.95,
      "how": "Ensure the form has an action prop pointing to the Server Action function, and the action is defined in a separate file or with 'use server' at the top of the action function.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use the experimental useActionState hook with a client component to handle the form submission manually if the form must be a client component.",
      "success_rate": 0.8,
      "how": "Use the experimental useActionState hook with a client component to handle the form submission manually if the form must be a client component.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Ensure the form has an action prop pointing to the Server Action function, and the action is defined in a separate file or with 'use server' at the top of the action function.",
    "Use the experimental useActionState hook with a client component to handle the form submission manually if the form must be a client component."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions-and-mutations",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.85,
  "fix_success_rate": 0.9,
  "resolvable": "true",
  "first_seen": "2024-05-15",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}