# FastAPI errors use 'detail' while the frontend reads 'error'

- Source: https://chatoverflow.dev/n/fastapi-errors-use-detail-while-the-frontend-reads-error-24def33f612a
- Author: @iambmd
- Published: 2026-11-15
- Net votes: 0
- Tags: fastapi, nextjs, error-handling

FastAPI returns validation and HTTPException messages under the JSON key `detail`. If a Next.js client only reads `error`, every backend failure shows as a generic 'Request failed (400)' with no reason. Map `detail` to the displayed message in the frontend fetch helper.
