# GraphQL mutation returned HTTP 400 with errors array

- **ID:** `api/graphql-http-status-400-mutation-returned-errors`
- **Domain:** api
- **Category:** protocol_error
- **Verification:** ai_generated
- **Fix Rate:** 82%

## Root Cause

GraphQL endpoint returns HTTP 400 when a mutation fails validation or execution, even though the request is syntactically valid JSON.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| graphql-js v16.8 | active | — | — |
| apollo-server v4.6 | active | — | — |
| express-graphql v0.12 | active | — | — |

## Workarounds

1. **In the client, check for errors array in response body even on 400, not just 200.** (90% success)
   ```
   In the client, check for errors array in response body even on 400, not just 200.
   ```
2. **Use a GraphQL client like Apollo that handles non-200 responses gracefully.** (85% success)
   ```
   Use a GraphQL client like Apollo that handles non-200 responses gracefully.
   ```

## Dead Ends

- **** — The request body is usually valid JSON; the error is in the mutation logic, not parsing. (75% fail)
- **** — Logging alone doesn't fix the underlying mutation error; only masks symptoms. (60% fail)
- **** — GraphQL spec allows 400 for business logic errors; headers are irrelevant. (80% fail)
