# GraphQL endpoint returned HTTP 200 with errors array

- **ID:** `api/graphql-http-status-200-with-errors`
- **Domain:** api
- **Category:** protocol_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

GraphQL specification allows partial success — HTTP 200 with errors key in response body when some resolvers fail but transport succeeds.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| graphql-js@16.8.0 | active | — | — |
| Apollo Server 4.9.0 | active | — | — |
| Apollo Client 3.8.0 | active | — | — |
| graphql-yoga 5.0.0 | active | — | — |

## Workarounds

1. **In Apollo Client, set errorPolicy to 'all' to surface errors: new ApolloClient({ uri: '/graphql', errorPolicy: 'all' })** (90% success)
   ```
   In Apollo Client, set errorPolicy to 'all' to surface errors: new ApolloClient({ uri: '/graphql', errorPolicy: 'all' })
   ```
2. **Parse response body manually: const { data, errors } = await response.json(); if (errors) { console.error('GraphQL errors:', errors); }** (85% success)
   ```
   Parse response body manually: const { data, errors } = await response.json(); if (errors) { console.error('GraphQL errors:', errors); }
   ```
3. **Use a middleware to check for errors in GraphQL responses and throw if any exist** (80% success)
   ```
   Use a middleware to check for errors in GraphQL responses and throw if any exist
   ```

## Dead Ends

- **** — Checking only HTTP status code (200) without parsing response body for errors field (75% fail)
- **** — Assuming all 200 responses are successful and ignoring errors array entirely (60% fail)
- **** — Setting Apollo Client errorPolicy to 'ignore' which silently discards errors (80% fail)
