# Error: Server Actions require the request body to be parsed as FormData or JSON. Received unexpected content type: application/x-www-form-urlencoded

- **ID:** `nextjs/server-action-formdata-encoding`
- **Domain:** nextjs
- **Category:** protocol_error
- **Verification:** ai_generated
- **Fix Rate:** 92%

## 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.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 14.2.0 | active | — | — |
| 15.0.0 | active | — | — |
| 14.2.15 | active | — | — |

## Workarounds

1. **Use the native form action attribute with a Server Action function directly, which automatically handles proper encoding.** (95% success)
   ```
   Use the native form action attribute with a Server Action function directly, which automatically handles proper encoding.
   ```
2. **If calling from JavaScript, use FormData object and avoid setting Content-Type header (let the browser set it automatically).** (90% success)
   ```
   If calling from JavaScript, use FormData object and avoid setting Content-Type header (let the browser set it automatically).
   ```

## Dead Ends

- **Adding 'Content-Type: multipart/form-data' manually without FormData** — 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. (85% fail)
- **Setting enctype attribute on the HTML form to 'application/json'** — HTML forms natively only support application/x-www-form-urlencoded, multipart/form-data, and text/plain. application/json is not valid for form submission. (90% fail)
- **Using JSON.stringify on FormData before sending** — FormData cannot be serialized with JSON.stringify. You must send the FormData object directly as the body. (95% fail)
