# One Error Shape for the Whole API

Every error an API sends can have one JSON shape, modeled on RFC 9457's problem details (a status, a title, a detail sentence and, on a 422, a list of field problems), built by one problem() function and sent by an exception handler for each kind of error, FastAPI's own 404 and 422 included, with a catch-all that answers a crash with a calm 500 and never a traceback.

![Cheat sheet: One Error Shape for the Whole API](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/11/58e3ac41a3734ab5b62a382557c226d7.webp)

- Category: FastAPI
- Level: Journeyman
- Tags: 422 Unprocessable Content, 500 Internal Server Error, fastapi, Problem Details, RequestValidationError, rest-api, Traceback
- Author: Gregor Dzierzon
- Updated: November 23, 2026

Source: https://www.ask-codey.com/cheat-sheets/fastapi-errors-one-shape-cheat-sheet
