# GraphQL says 200 OK, and your client's data can still be missing

> The errors sit in the response body, and Apollo Client's default setting quietly throws away the part of the data that was still usable.

Original: https://fdetimes.net/en/guides/graphql-200-ok-partial-data-errors/

Shopify's API documentation contains a sentence every integration engineer should tape to their monitor: a 200 status from the GraphQL API only means Shopify has responded, not that the operation succeeded. Even when you are rate limited, the Admin API and the Storefront API still return 200 OK, with a `THROTTLED` error inside the response body.

GitHub does the same. Exceed the GraphQL API's primary rate limit and you still get a 200 along with an error message. If a query consumes too many resources, GitHub cuts the request short and returns a partial result, plus an error saying a limit was exceeded.

For an FDE, this is the classic trap on a client site. The sync job runs green for two weeks, the dashboard raises nothing, and then one day the operations team asks why a fifth of customers have no email address. Your code did not crash. It simply trusted the 200.

## One failed field does not break the whole response

To fix this, you need to understand how GraphQL handles errors. The GraphQL specification (September 2025 edition) says that when a field raises an error during execution, that position is treated as if it returned null, and the error must be added to the `errors` list. The rest of the query carries on.

It gets more complicated when the field is declared Non-Null. Null is not allowed there, so it is pushed up to the parent position. If every position from the root down to the failure is Non-Null, the whole of `data` becomes null.

So how do you know whether a null is real data or the trace of an error? The specification answers with the `path` entry in each error: it points to the exact position that failed, so the client can tell the two cases apart.

The debugging guide on graphql.org adds a tip: when you get 200 OK, read the `errors` array; if the response still contains `data`, your query is most likely valid, and the error happened at execution time, for example bad input, a permission denial or a server-side bug.

**Key point:** A 200 from GraphQL says the server answered. It does not say the data is complete.

## Reading an incomplete response from top to bottom

Take a hypothetical case: you are pulling orders with customer emails from a client's API, and your token is denied permission to read one customer's details. The response looks like this:

```json
{
  "data": {
    "orders": {
      "nodes": [
        { "id": "1", "customer": { "email": "a@example.com" } },
        { "id": "2", "customer": null }
      ],
      "pageInfo": { "hasNextPage": true, "endCursor": "abc" }
    }
  },
  "errors": [
    { "message": "Access denied", "path": ["orders", "nodes", 1, "customer"] }
  ]
}
```

Read it in order. There is `data`, so the query is valid. There are `errors`, so this is a partial success. The `path` points to `nodes[1].customer`, meaning the null on order 2 comes from a permission error, not from the order having no customer. And `hasNextPage: true` is a reminder that this is only one page.

Now change the schema: if `customer` is declared Non-Null, the null propagates up to the order element itself. If the elements in `nodes` are also Non-Null, it propagates further to the list, and so on. A permission error on a single customer can wipe out an entire page of results, or turn `data` into null.

Even when the `errors` array is empty, the response can still be incomplete, because it is only one page. GitHub requires `first` and `last` to be between 1 and 100, so long lists must be paginated. A job that reads only the first page will miss data without a single error.

## Turning that reading into code

That reading should live in one function shared by every call, so nobody has to remember it. A sketch in Python:

```python
class GraphQLFailure(Exception): ...
class Throttled(Exception): ...

def check_response(resp, mutation_field=None):
    body = resp.json()
    data = body.get("data")
    errors = body.get("errors") or []

    # Step 1: no data -> complete failure
    if data is None:
        raise GraphQLFailure(errors)

    # Step 2: rate limit errors live in the response body, not the HTTP status.
    # extensions.code is only an example location: each API puts its error code
    # somewhere different, so read the provider's docs and adjust this condition.
    if any(e.get("extensions", {}).get("code") == "THROTTLED" for e in errors):
        raise Throttled(errors)

    # Step 3: record exactly which positions are null because of errors
    error_paths = [tuple(e.get("path", [])) for e in errors]

    # Step 4: mutations also return business errors in the payload
    if mutation_field:
        payload = data.get(mutation_field)
        # payload can be null if an error propagated up from a Non-Null field
        if payload is None:
            raise GraphQLFailure(errors)
        user_errors = payload.get("userErrors") or []
        if user_errors:
            raise GraphQLFailure(user_errors)

    # Step 5 (pagination) does not live here: the loop that calls this function
    # must read pageInfo itself and keep calling while hasNextPage is true.
    return data, error_paths
```

Step 4 handles a third kind of error. With Shopify Admin API mutations, input errors and business errors do not appear in `errors`; they come back as `UserError` objects in the payload's `userErrors` field. Skip that field and you will believe a product was created when the server actually rejected it.

The function only checks individual responses, so the fifth step belongs to the layer that calls it. The sync loop calls `check_response` for each page, reads `pageInfo`, and as long as `hasNextPage` is true sends the next query with the `endCursor` it just received. Only once the last page has passed through the function can you claim to have everything.

`error_paths` is the most valuable part. With it, the job can write the valid orders, flag the failed records separately for a rerun, and report a concrete number instead of staying silent.

## Client libraries can hide errors for you

If the client has a frontend, check the client layer too. Apollo Client, with its default `errorPolicy` of `"none"`, puts errors in the `error` field and sets `data` to `undefined`, discarding the part of the data that was still usable. The `"all"` policy keeps both, but then your code has to read the errors itself.

Relay goes the other way: by default a failed field simply receives null, and the interface renders it as empty, as if there were no data. The `@catch` directive lets the error state flow into the data instead of null, so the component knows and can render correctly.

When the client uses federation, there is another layer of concealment. GraphOS Router and Apollo Router Core hide subgraph error details from the response sent to the client by default. If you see `errors` with vague messages, do not guess: ask for access to the configuration and logs of both the router and the subgraphs.

## The most common mistakes

The first is checking only the HTTP status. As Shopify and GitHub show, rate limits, permission errors and truncated results can all arrive with a 200.

The second is treating every null as real data. Without checking against `path`, you will write "customer has no email" into the client's data warehouse, and that error spreads into every report downstream.

The third is waiting for a dedicated status code. The GraphQL over HTTP draft does propose a `294 Partial Success` code, but it is still a draft; do not write code that assumes the client's server already uses it. The other two were covered above: forgetting `userErrors` in mutations, and reading one page as if it were the whole set.

On a CV, a line such as "built a GraphQL response-checking layer that detects data missing because of permission errors and rate limits in sync jobs" says more than the word "GraphQL" in a skills list.

In FDE interviews, the time you found missing data behind a 200 is a debugging story worth having ready: a symptom, a cause and a fix.

## This week's exercise

Pick a public GraphQL API you have a token for, such as GitHub. Write a query that pulls a long list with `first: 100`, deliberately add a field you are not allowed to read, then run it through the `check_response` function above inside a loop driven by `hasNextPage`. Record three things: what remains in `data`, where `path` points, and how many pages it takes to get everything.

The next time a client says "our API works fine, it always returns 200," you will know which array to open first.

**Try this week:**

- Find a place in your integration code that only checks resp.status_code == 200 against a GraphQL API and add a step that reads the errors array.
- Deliberately send a query with a field you are not allowed to read, then record the data, errors and path the server returns.
- Check Apollo Client's errorPolicy (or how Relay handles nulls) in your current project and document it in the README.

## Sources

- [GraphQL Specification, September 2025 Edition](https://spec.graphql.org/September2025/)

- [GraphQL over HTTP (Working Draft)](http://http-spec.graphql.org/draft/)

- [Common HTTP Errors and How to Debug Them](https://graphql.org/learn/debug-errors/)

- [Shopify API response status and error codes](https://shopify.dev/docs/api/usage/response-codes.md)

- [UserError - GraphQL Admin](https://shopify.dev/docs/api/admin-graphql/latest/objects/UserError)

- [Rate limits and query limits for the GraphQL API](https://docs.github.com/en/graphql/overview/rate-limits-and-query-limits-for-the-graphql-api)

- [Handling operation errors (Apollo Client)](https://www.apollographql.com/docs/react/data/error-handling)

- [Subgraph Error Inclusion (Apollo Router)](https://www.apollographql.com/docs/graphos/routing/observability/subgraph-error-inclusion)

- [@catch directive (Relay)](https://relay.dev/docs/guides/catch-directive/)
