# Error: Server Actions require the request body to be parsed as FormData or JSON. Received unexpected content type.

- **ID:** `nextjs/server-action-body-parsed-json-error`
- **Domain:** nextjs
- **Category:** protocol_error
- **Verification:** ai_generated
- **Fix Rate:** 85%

## Root Cause

Server Actions in Next.js expect the client to send requests with Content-Type application/x-www-form-urlencoded or multipart/form-data (for form submissions) or application/json (for programmatic calls). An unsupported content type (e.g., text/plain) causes parsing failure.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 14.2.0 | active | — | — |
| 14.2.1 | active | — | — |
| 15.0.0 | active | — | — |
| 15.1.0 | active | — | — |

## Workarounds

1. **Ensure client-side form submissions use the standard HTML form element or the 'useFormState' hook, which automatically sends the correct content type. For programmatic calls, use 'new FormData(formElement)' or pass a plain object and set Content-Type: application/json.** (90% success)
   ```
   Ensure client-side form submissions use the standard HTML form element or the 'useFormState' hook, which automatically sends the correct content type. For programmatic calls, use 'new FormData(formElement)' or pass a plain object and set Content-Type: application/json.
   ```
2. **If using fetch directly, construct the body as FormData: const formData = new FormData(); formData.append('key', value); await fetch('/action', { method: 'POST', body: formData });** (85% success)
   ```
   If using fetch directly, construct the body as FormData: const formData = new FormData(); formData.append('key', value); await fetch('/action', { method: 'POST', body: formData });
   ```

## Dead Ends

- **Adding 'Content-Type: multipart/form-data' header manually in JavaScript fetch calls without properly encoding the body** — The server still receives the body as a string, not as multipart parts. The content type must match the actual encoding. (70% fail)
- **Setting 'bodyParser: false' in API route configuration for Server Actions** — Server Actions do not use the API route body parser; they have their own parsing logic. Disabling it has no effect. (90% fail)
- **Using JSON.stringify on FormData before sending** — FormData is not a plain object; JSON.stringify will return an empty object. The server expects actual FormData entries. (95% fail)
