# Error: Server Action failed. FormData is undefined or empty.

- **ID:** `nextjs/server-action-formdata-undefined`
- **Domain:** nextjs
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 90%

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

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| next@14.2.0 | active | — | — |
| next@15.0.0 | active | — | — |
| react@18.3.0 | active | — | — |

## Workarounds

1. **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.** (95% success)
   ```
   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.
   ```
2. **Use the experimental useActionState hook with a client component to handle the form submission manually if the form must be a client component.** (80% success)
   ```
   Use the experimental useActionState hook with a client component to handle the form submission manually if the form must be a client component.
   ```

## Dead Ends

- **** — '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. (60% fail)
- **** — Server Actions require the form action attribute to properly bind FormData. onClick bypasses this and sends undefined. (80% fail)
- **** — Server Actions cannot be called directly from client components without 'use server' on the action function. This leads to undefined FormData. (70% fail)
