Summary

  • RFC 9457, July 2023, exists because HTTP status codes are "sometimes not sufficient to convey enough information about an error to be helpful" — especially to "non-human consumers of HTTP APIs".
  • It gives each kind of failure a URI to be known by: consumers "MUST use the 'type' URI ... as the problem type's primary identifier", the default is about:blank, and a dereferenceable type URI should lead to human-readable documentation.

One response, two audiences

An error response has two readers, and they want different things. The status code is for the machinery in the middle — libraries, caches, proxies, the load balancer that has never heard of your business logic — and all it needs is a coarse verdict it already knows how to parse.

The body is for the client that actually called you. It wants the reason, the numbers and the next move. The spec's running example is an account that cannot pay: 403 for the infrastructure, and a body that says the balance is 30, the thing costs 50, and here are the accounts to top up.

None of that is new. Writing it down as a format is. That is the difference between two teams that have to talk to each other and two teams that can ship without.

A name for every kind of failure

The interesting decision is the type member: a URI that identifies the kind of problem, not the incident. "Out of credit" gets an address. "Malformed request" gets an address. The address is stable, and it is the same address for every customer who ever runs out of credit.

If that URI happens to resolve, dereferencing it "SHOULD provide human-readable documentation" — a page a support engineer can read at two in the morning. The spec also says clients should not fetch it automatically, which is the right call: an error path that makes a network request is an error path that can fail twice.

The type is a name, not a link

Here the spec is more careful than the internet usually is. A type URI is allowed to be unresolvable, and plenty are. It is an identifier that happens to look like an address, not an address that promises a page.

That distinction is worth keeping. A URI here does what a namespace does: it pins a string to a stable meaning. Whether the string also happens to be a URL is a separate question, and confusing the two is how you end up with an error format that depends on somebody's web server staying up.

Category versus occurrence

Problem details can also carry a URI for the specific event, which the memo illustrates with the phrase "the time Joe didn't have enough credit last Thursday".

The category tells the client what to do. The occurrence tells support which event to open. One is a manual, the other is a ticket number, and collapsing them is why so many error logs are searchable but not answerable.

Why the format mattered

Before there was a standard, every API invented its own error shape and every client wrote an adapter. A shared format does not make errors good. It makes them legible to tools that never met the API — the gateway, the SDK, the dashboard, the on-call runbook.

The bill arrives later. Once errors are shaped, changing them is a versioning problem, and a badly designed error body can outlive the code that produced it. Compatibility is a one-way door: cheap to walk through, expensive to walk back.

The quiet achievement

RFC 9457 does not make the internet more reliable. It makes failure describable, which is the next best thing, and it does it by giving the description a name both sides can look up.

Ten years from now the member names will look quaint. The idea underneath will not: an error has a type with a URI and an occurrence with an identifier, and the gap between the two is the gap between knowing what to do and knowing what happened.