A 403 with ten fields can still say nothing useful

In July 2023 RFC 9457 replaced RFC 7807, which had defined problem details back in March 2016. The newer document did more than renumber a specification. It added a problem type registry, guidance on multiple problems, and advice for type URIs that cannot be dereferenced. The central idea survived: an error response carries five standard members. type is a URI reference naming the problem type and defaults to about:blank. status is a JSON number holding an HTTP status code, marked advisory. title is a short human summary that should stay stable except for localisation. detail explains this particular occurrence. instance is a URI identifying the occurrence.

The member worth pausing on is status. A generator MUST make it agree with the actual HTTP response code, and the member cannot stand in for the real status line. Caches and proxies read the status line. Application logic reads type. Both travel in the same body, each answering a different question.

Problem details serialise in two equivalent forms: application/problem+json and application/problem+xml. Describing the format as JSON alone leaves out half the specification. The familiar out-of-credit example pairs a 403 with a type URI ending in out-of-credit, an instance carrying an event identifier, a detail about a balance of thirty against a requirement of fifty, and two extension fields named balance and accounts. A cache sees a 403. Billing logic sees out-of-credit. Neither needs to read the other's field.

The signal map

LayerMachine-readable handleConsumed by
HTTP status line403, 404, 503caches, proxies, generic client libraries
RFC 9457 problem detailstype URI, instanceapplication logic, error dashboards
AIP-193 statuscode plus (reason, domain)generated clients, service-to-service calls
Microsoft error objecttop-level code, nested innererrorclients parsing at their own depth
Stripe response headerStripe-Should-Retryretry policy inside the SDK

A reason and a domain beat a sentence

Google's AIP-193, approved and last updated in October 2024, requires a service to return google.rpc.Status with code, message, and details. The code must be a numeric value from google.rpc.Code; five means NOT_FOUND. Every error response must also carry an ErrorInfo in details. That object supplies two fields worth branching on: reason, at most sixty-three characters in upper snake case with no leading or trailing underscore, and domain, globally unique, such as a service hostname. The same logical error must reuse the same (reason, domain) pair, and distinct logical errors must not share one.

Dynamic context goes into metadata, whose keys are capped at sixty-four characters. AIP-193 states the purpose plainly: request information that appears in Status.message must also appear in metadata, so machine clients never have to parse the message text. Message text is written for people and can change. A client that switches on a substring of it has turned a sentence into a contract.

There is a wrinkle at the HTTP boundary. In the JSON representation the inner error.code is the HTTP status, so a missing resource shows code: 404 while the status field holds the enum name NOT_FOUND. Two numbers, two layers, one response. Retryable-code classification lives in AIP-194, whose text was not verified for this article; AIP-193 only points to it in further reading. Any claim that AIP-193 itself publishes a retry list misreads the document.

A small top level and a deep one

Microsoft's REST API Guidelines took another route to the same split. The error body must be a single JSON object with error at the top. Inside it, code is a service-defined, language-neutral string meant to be readable by people, and message is written for developers. Localising it for end users is discouraged. Optional members include target for the offending property, details for several errors, and innererror for finer codes.

The guidance suggests roughly twenty possible values using SHOULD language, which leaves room above that figure. Adding a new visible top-level value is a breaking change for existing clients and calls for a version bump. Finer distinctions go into innererror, and clients must walk the nesting and choose the deepest code they understand. The contract can evolve while older callers keep working. A client that stops at the top level is fine; a newer one can dig further.

A caveat belongs beside the advice. These sections live in the deprecated vNext guidelines, now split into separate graph and Azure booklets. Calling them a current mandatory Microsoft standard misreads their status. What survived the reorganisation is the design pattern: transient failures suitable for retry SHOULD carry Retry-After, and client errors caused by bad input are counted apart from availability. A request rejected because its data was invalid does not drag an availability figure down.

A retry flag in the header

Stripe pushes one of those layers all the way into the response headers. Stripe-Should-Retry: true asks for exponential backoff, false asks for no retry, and an absent header leaves the decision to the client's reading of the status code. Stripe's own SDKs follow the header. A 429 carries an explicit instruction to back off exponentially, and a 500 that returns a cached result is treated as indeterminate because the operation may or may not have completed.

Two details set this apart from a general rule. The header is a vendor invention; neither HTTP nor the IETF standardised it. The idempotency window that often travels with it is version-specific: Stripe API v1 keeps a key for at least twenty-four hours and marks replayed responses with Idempotent-Replayed: true, while v2 uses thirty days. Collapsing both into one figure produces a rule no Stripe endpoint actually follows. Vendor error-code lists help in operations; their authority stops at the catalogue.

Where the boundary sits

Standards and vendor guides disagree in small but consequential ways. Microsoft's Azure booklet treats an added JSON response field as breaking; Stripe counts a new response attribute as compatible; AIP-193 binds a (reason, domain) pair to one logical error. None of these is a universal rule, and copying one platform's classification into another inherits its assumptions. A client only needs a small set of fields, and those fields should survive a rewrite of the surrounding prose. Status goes to generic middleware, type or (reason, domain) or code to application branches, and response headers to retry decisions. Prose belongs in title, detail, and message, where nobody should be parsing it.

The material behind this article contains no first-hand measurement of mini-program error rates. What transfers is the contract design. A shared runtime with an open catalog can carry one error convention to several host environments, and the economic case rests on how many places must run a structured parser. Whether a host emits fewer 429s would need measuring, and no such figure is available here. The practical payoff is counted in parsers a team must maintain. Cross Mini App reduces that count by letting one structured error contract travel with a capability across the surfaces where the runtime is allowed to run.

Sources