{
  "id": "nextjs/server-action-formdata-encoding",
  "signature": "Error: Server Actions require the request body to be parsed as FormData or JSON. Received unexpected content type: application/x-www-form-urlencoded",
  "signature_zh": "错误：服务器操作要求将请求体解析为 FormData 或 JSON。收到意外的内容类型：application/x-www-form-urlencoded",
  "regex": "Error: Server Actions require the request body to be parsed as FormData or JSON\\. Received unexpected content type: application/x-www-form-urlencoded",
  "domain": "nextjs",
  "category": "protocol_error",
  "subcategory": null,
  "root_cause": "A Server Action is called with a non-standard content type (e.g., application/x-www-form-urlencoded) instead of multipart/form-data or application/json. This typically happens when submitting a form manually via fetch without proper headers.",
  "root_cause_type": "generic",
  "root_cause_zh": "服务器操作以非标准内容类型（例如 application/x-www-form-urlencoded）被调用，而非 multipart/form-data 或 application/json。这通常发生在通过 fetch 手动提交表单而未设置正确标头时。",
  "versions": [
    {
      "version": "14.2.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "15.0.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "14.2.15",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Adding 'Content-Type: multipart/form-data' manually without FormData",
      "why_fails": "The content type must match the actual body format. Sending multipart/form-data with a JSON string body still fails because the server expects FormData parsing.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    },
    {
      "action": "Setting enctype attribute on the HTML form to 'application/json'",
      "why_fails": "HTML forms natively only support application/x-www-form-urlencoded, multipart/form-data, and text/plain. application/json is not valid for form submission.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "Using JSON.stringify on FormData before sending",
      "why_fails": "FormData cannot be serialized with JSON.stringify. You must send the FormData object directly as the body.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Use the native form action attribute with a Server Action function directly, which automatically handles proper encoding.",
      "success_rate": 0.95,
      "how": "Use the native form action attribute with a Server Action function directly, which automatically handles proper encoding.",
      "condition": "",
      "sources": []
    },
    {
      "action": "If calling from JavaScript, use FormData object and avoid setting Content-Type header (let the browser set it automatically).",
      "success_rate": 0.9,
      "how": "If calling from JavaScript, use FormData object and avoid setting Content-Type header (let the browser set it automatically).",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Use the native form action attribute with a Server Action function directly, which automatically handles proper encoding.",
    "If calling from JavaScript, use FormData object and avoid setting Content-Type header (let the browser set it automatically)."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.88,
  "fix_success_rate": 0.92,
  "resolvable": "true",
  "first_seen": "2024-06-10",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}