---
title: "Modeling Errors in GraphQL"
description: "GraphQL's built-in errors array is untyped and undiscoverable, so Zalando splits failures into two categories based on who can act on them."
url: "https://swe.quest/articles/modeling-errors-in-graphql-bde0367a83f4ea52"
canonical: "https://engineering.zalando.com/posts/2021/04/modeling-errors-in-graphql.html"
source: "Zalando Engineering"
published: "2021-04-12"
difficulty: "medium"
kind: "Opinion"
reading_minutes: 10
tags: ["graphql","api-design"]
---

# Modeling Errors in GraphQL

A post on [Zalando Engineering](https://swe.quest/sources/zalando.md), published 2021-04-12, 10 min read, Opinion. Original: [https://engineering.zalando.com/posts/2021/04/modeling-errors-in-graphql.html](https://engineering.zalando.com/posts/2021/04/modeling-errors-in-graphql.html)

## Summary

GraphQL's built-in errors array is untyped and undiscoverable, so Zalando splits failures into two categories based on who can act on them. Errors stay in response.errors with an extensions.code (NOT\_FOUND, NOT\_AUTHORIZED, or no code for internal failures) and keep GraphQL's null-propagation semantics. Problems, named after RFC 7807, are schema types returned through Success/Problem result unions with translated messages. They are reserved mainly for mutation input validation, where only the customer can fix the issue. Using Problem types everywhere would bloat queries and front-end branching, so they should be used sparingly.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [GraphQL](https://swe.quest/tags/graphql.md) (Backend & APIs)
- [API design](https://swe.quest/tags/api-design.md) (Backend & APIs)

## Prerequisites

- GraphQL schemas and queries ([easy posts on GraphQL](https://swe.quest/tags/graphql.md?difficulty=easy))
- GraphQL union types ([easy posts on GraphQL](https://swe.quest/tags/graphql.md?difficulty=easy))

## Keywords

GraphQL, RFC 7807, Zalando

## Related posts

- [How we use GraphQL at Europe's largest fashion e-commerce company](https://swe.quest/articles/how-we-use-graphql-at-europe-s-largest-fashion-e-commerce-company-98c53d6b8b858147.md): Zalando Engineering · 2021-03-03 · Easy · 6 min read · GraphQL, API design, Microservices, E-commerce, Resilience
  Zalando replaced a sprawl of per-page and per-platform Backend-for-Frontend services with a single unified GraphQL API owned via a shared monorepo across 12+ domain teams.
- [GraphQL persisted queries and Schema stability](https://swe.quest/articles/graphql-persisted-queries-and-schema-stability-a96dada14e0377f0.md): Zalando Engineering · 2022-02-16 · Medium · 6 min read · GraphQL, API design, Schema migrations, Deployment
  Zalando disables arbitrary GraphQL queries in production and accepts only query IDs that were persisted at build time, where an ID is a hash of the normalized query.
- [Migrating from Apollo Tooling to GraphQL Codegen at Yelp](https://swe.quest/articles/migrating-from-apollo-tooling-to-graphql-codegen-at-yelp-732b107d437979cc.md): Yelp Engineering · 2026-07-16 · Medium · 11 min read · GraphQL, TypeScript, Build systems, Refactoring & migrations, Open source
  Yelp replaced the deprecated apollo-tooling codegen with GraphQL Codegen across a 500+ package React/TypeScript monorepo without requiring developers to change imports or queries.
- [Understanding GraphQL Directives: Practical Use-Cases at Zalando](https://swe.quest/articles/understanding-graphql-directives-practical-use-cases-at-zalando-20796a0cce64c9f9.md): Zalando Engineering · 2023-10-18 · Medium · 12 min read · GraphQL, API design, Identity & auth, Observability
  Zalando uses custom GraphQL directives to declare cross-cutting server behavior in the schema and to attach client metadata in queries.
- [How pg\_graphql works](https://swe.quest/articles/how-pg-graphql-works-70dff1dd9d5a0c27.md): Supabase · 2024-01-24 · Medium · 9 min read · GraphQL, PostgreSQL, Rust, Compilers
  pg\_graphql is a Rust-based Postgres extension that reflects the SQL schema as a GraphQL schema and serves queries through a \`graphql.resolve\` SQL function, with no separate server.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
