LanguageEnglish
Build →

Learn · QuorumAuth

What is RFC 9457 Problem Details?

RFC 9457 is the IETF standard that defines one machine-readable format, Problem Details, for describing errors in HTTP API responses.

Updated

Many error formats vs one

One format per service

  • Each service invents its own error shape
  • Clients write a parser per service
  • A load balancer may answer with HTML
  • Errors nobody can search for

RFC 9457 problem details

  • One shape, as application/problem+json
  • Clients branch on type
  • instance points support to the exact request
  • Unknown extensions are ignored, nothing breaks

In short Every client reads every error the same way, whichever service sent it.

Two columns. Without a standard, each service invents its error shape, clients write a parser per service, a load balancer may return an HTML page, and errors cannot be searched. With RFC 9457, every error has one shape served as application/problem+json, clients branch on type, instance points support to the exact request, and unknown extension members are ignored so nothing breaks.

One error shape, served as application/problem+json, replaces a parser per service.

Your API has twelve services and twelve error formats. One returns {"error": "not found"}, another {"message": "...", "code": 4004}, a third an HTML page from the load balancer. Every client writes a parser per service, support tickets quote errors nobody can search for, and SDKs guess. RFC 9457 replaces all of that with one shape every client can read.

What RFC 9457 defines

RFC 9457, Problem Details for HTTP APIs, published by the IETF in 2023, defines a JSON (and XML) object for carrying error details in an HTTP response. It obsoletes RFC 7807, which introduced the format in 2016. A problem details response is served with the media type application/problem+json.

The five standard members

Member Type Meaning
type URI reference Identifies the problem type. Defaults to about:blank when absent.
title string Short, human-readable summary of the problem type. Should not change between occurrences.
status number The HTTP status code, repeated for convenience.
detail string Human-readable explanation of this occurrence.
instance URI reference Identifies this specific occurrence, for example for support or logs.

All five are optional, but type is the one clients should branch on. Treat title and detail as text for humans, not something to parse.

An example

HTTP/1.1 404 Not Found
Content-Type: application/problem+json

{
  "type": "urn:api-bones:error:resource-not-found",
  "title": "Resource Not Found",
  "status": 404,
  "detail": "booking 42 not found",
  "instance": "urn:uuid:01234567-89ab-cdef-0123-456789abcdef"
}

A client checks type, recognises “resource not found”, and shows its own message. The instance value lets a support engineer find the exact request in logs.

Extension members

You can add your own members. A common one is a list of field errors on a validation failure:

{
  "type": "https://docs.example.com/errors/validation-failed",
  "title": "Validation Failed",
  "status": 400,
  "detail": "2 fields are invalid",
  "errors": [
    { "field": "/email", "message": "must be a valid address" },
    { "field": "/seats", "message": "must be at least 1", "rule": "min" }
  ]
}

The RFC requires clients to ignore extension members they do not understand, so adding one does not break existing consumers.

How a client should handle problem details

  1. Check the Content-Type. If it is application/problem+json, parse it.
  2. Branch on type, not on title or detail.
  3. Fall back to status for unknown types.
  4. Log instance so support can correlate.
  5. Show detail to users only if your API promises it is safe to display.

How a client reads a problem

  1. Content-Type is problem+json? → Branch on typeparseUnknown type: use status
  2. Branch on type → Log instance for supportUnknown type: use status
  3. Log instance for support → Show detail only if safe

The client checks that the Content-Type is application/problem+json and parses it. It branches on type; for an unknown type it falls back to status. It logs instance so support can correlate, and shows detail to users only if the API promises it is safe to display.

Branch on type, never on title or detail, and fall back to status when the type is unknown.

Mapping common errors

Situation Status Example type slug Useful extension
Malformed JSON 400 bad-request None
Field validation failed 400 or 422 validation-failed errors list with field pointers
No or bad credentials 401 unauthorized None; never say which part was wrong
Authenticated but not allowed 403 forbidden None
Unknown resource 404 resource-not-found None
State conflict or reused idempotency key 409 conflict Current state, if safe to share
Too many requests 429 rate-limited Retry hint, alongside Retry-After
Unexpected server failure 500 internal-server-error instance only

Migrating from a custom error format

  1. Inventory the error shapes your services return today.
  2. Choose a type scheme: URNs in your own namespace, or URLs under your documentation site. Write it down.
  3. Map each existing error code to a type, keeping the old code as an extension member for one release so existing clients keep working.
  4. Serve application/problem+json and update SDKs to read type.
  5. Convert middleware errors: gateways, timeouts and panics.
  6. Remove the old code field once clients have moved.

When to use it

  • Every HTTP API that returns errors, which is every HTTP API.
  • Multi-service platforms, where one shape across services removes a parser per service.
  • Public APIs and SDKs, where generated clients benefit from one typed error.
  • Gateways and middleware, which can convert their own failures into the same shape.

Pitfalls

  • Unstable type URIs. Changing type is a breaking change. Pick a scheme, URN or documentation URL, and keep it.
  • Parsing detail. It is free text for humans and will change.
  • Leaking internals. Stack traces, SQL and internal hostnames do not belong in detail.
  • Status mismatch. The status member should match the actual HTTP status code.
  • Mixed formats. Errors raised by middleware, timeouts or panics often escape as plain text. Convert them too.
  • Wrong content type. Sending problem details as application/json hides them from clients that look for the media type.

Problem details pair naturally with request headers like idempotency keys: a reused key is a clear 409 problem.

How QuorumAuth handles RFC 9457

QuorumAuth services build their errors on api-bones, an MIT-licensed Rust library published on crates.io. What the library does today:

  • One error type. ApiError serialises to RFC 9457 problem details with type, title, status, detail and instance, served as application/problem+json.
  • A fixed code list. ErrorCode maps each variant to its HTTP status, for example ResourceNotFound to 404, Conflict to 409 and RateLimited to 429, and serialises as a type URI.
  • Your choice of type scheme. By default, type URIs are URNs in the api-bones namespace, such as urn:api-bones:error:not-found. An application can set its own URN namespace or a documentation base URL, and every error then uses that scheme.
  • Field-level errors. ValidationError carries a JSON Pointer to the field, a message and an optional rule name, in the problem’s errors member. Extension members are supported.
  • Middleware coverage. A Tower ProblemJsonLayer maps errors from inner services that are not already ApiError into problem details.

QuorumAuth’s OIDC discovery endpoint reports errors as problem details; its Connect RPC API uses Connect error codes. To see QuorumAuth in a real app, build sign-in and account controls with QuorumAuth.

What is the difference between RFC 9457 and RFC 7807?

RFC 9457, published in 2023, obsoletes RFC 7807. The format is compatible; the newer RFC clarifies the rules, adds guidance on multiple problems and type URIs, and sets up a registry of common problem types.

What content type do problem details use?

application/problem+json for JSON. The RFC also defines application/problem+xml.

Does the type field have to be a URL that resolves?

No. It must be a URI reference. A resolvable URL pointing to documentation is helpful, and a URN is valid too. When type is omitted, it is treated as about:blank.

Can I add my own fields?

Yes. Extension members are allowed, and clients must ignore extensions they do not recognise.

Talk to sales about QuorumAuth.

QuorumAuth is sold through our sales team. The Build page shows the drop-in sign-in on your origin and how to reach sales about your stack.

Go to Build and contact sales →