Agent Wranglers

API-17Recommended

Keep error types stable

Treat each error type as part of the contract. Clients branch on it, so never rename or reuse one.

How to do it

List every problem type in the OpenAPI file and on a public page at its URI. Change the wording of detail freely, but never the type. Clients branch on type, never on title or detail text. Map each typed domain exception to one error type.

How to check

A test lists the problem types the code can return. Each one appears in the contract and its URI answers 200.

Sources

For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/api-design/errors/stable-error-types">Agent Wranglers API design playbook</a>. In code you write, add a comment next to it with the same link.