Error Codes People and Agents Can Follow¶
A developer integrating your API hits 409 Conflict with the message "Object modified concurrently." What now?
They search your docs, find a table of status codes, and open a ticket. An AI agent in the same spot does worse: it
retries, or guesses.
The fix is old and simple, and most APIs still skip it: give every error a code, and give every code a page.
What an error should carry¶
RFC 9457, Problem Details for HTTP APIs, names the parts:
type: a URL that explains this kind of error. Follow it, and you learn what happened and what to do.title: the kind's fixed, short summary.detail: what went wrong this time.instance: this occurrence, something your logs can find.
Add a code for programs, as Google's ErrorInfo reason does: UPPER_SNAKE_CASE, stable forever, unique
within a domain that says who defines it. Programs branch on the code; people and agents follow the page.
What ObjectsGrid answers¶
Every ObjectsGrid error now carries all of them, beside the fields it always had:
{
"type": "https://objectsgrid.com/docs/error-details/cart-checked-out/",
"code": "CART_CHECKED_OUT",
"domain": "objectsgrid.com",
"title": "The cart was checked out",
"detail": "The cart was checked out and can't change.",
"instance": "org-447-5749/e00a6521-057d-4b1c-970e-cb0a665ba89c",
"message": "The cart was checked out and can't change.",
"httpStatusCode": 409
}
The page at type says what happened, the usual causes and how to fix it. The whole list is
Error details, and the same list for programs is
/.well-known/error-details/index.json. GraphQL errors
carry the same code as extensions.errorCode, with its page in extensions.type.
An error without a code of its own yet answers with its status's generic code, such as CONFLICT: every response
has a code from day one, and the specific ones grow. Match on the codes you handle; treat the rest by status.
Do the same for your API¶
Your API deserves the same, and your team shouldn't need a deploy to improve an explanation. Keep your codes in ObjectsGrid as DefinedTerms in a DefinedTermSet, with the causes and the fix in every language you support, and render your error pages from them. Your API returns the code and the link; ObjectsGrid is never in that request's path. See Explain your API's errors.
What never goes in a link¶
An error link explains a kind of error. It carries the code and your request id, never the data of the failed request: no customer names, no order contents. The page is public; the request stays in your logs, found by its id.