# An API error catalog template with safe recovery guidance

Canonical: https://githtml.com/guides/api-error-catalog-template
Published: 2026-11-23
Publisher: WaveTech LLC / gitHtml

Catalog errors by a stable identifier and the condition that produces them, then explain what the caller can safely do next. Include response shape, relevant status, retry semantics, and diagnostic evidence. Keep public errors separate from internal exceptions, and verify examples so a polished catalog does not promise recovery behavior the service does not actually support.

## Choose the public error identity

Identify the field or mechanism clients should use to distinguish errors. A human-readable message may change with wording or localization, so do not assume it is the stable programmatic contract. Record whether the service uses a structured problem format, an application code, or another documented scheme. Separate the HTTP status's broad meaning from the specific application condition. An internal exception class should not appear as a public code merely because a log mentions it. Review which details are safe to expose and keep implementation traces, secrets, and customer-specific context out of published examples.

## Describe conditions and recovery precisely

Use the template below for each error that callers can reasonably handle. State the triggering condition, affected operation, stable response fields, and whether repeating the same request is appropriate. Retry advice depends on idempotency and the service's actual contract; do not label every server error retryable by habit. Include a safe synthetic response and explain variable fields. RFC 9457 provides a standard format for HTTP problem details, but adopting its shape does not define your application's error taxonomy or recovery guarantees. If the service uses that format, document its chosen problem types and extensions explicitly.

````text
Error identifier / problem type:
Operation and condition:
HTTP status:
Stable response fields:
Human explanation:
Caller correction:
Retry safety and conditions:
Sanitized example:
Support evidence:
Verified version:
````

## Test the catalog against controlled failures

Use approved test fixtures to trigger representative errors without harming real users or production resources. Compare the observed status, identifier, and response fields with the reference. Confirm that malformed input, missing authorization, unavailable dependencies, and business-rule failures are not conflated under a vague message. Record what sanitized information support needs when the documented recovery fails. Review the catalog when implementation handling changes, not only when response wording changes. A caller should be able to distinguish a request they can correct from an operation they must not blindly repeat, and know when the available evidence is insufficient for safe automation. Document whether a failed operation may have partially completed before the response was returned. That uncertainty can determine whether the caller must reconcile state instead of automatically submitting the operation again.

1. Identify the stable public error code or problem type separately from message text.
2. Document conditions, response fields, and verified retry semantics.
3. Use synthetic examples and controlled failures without exposing internal traces.
4. Check that recovery guidance distinguishes caller correction, retry, and escalation.

## Sources and further reading

- [RFC 9457: Problem details for HTTP APIs](https://www.rfc-editor.org/rfc/rfc9457)

## Related guides

- [An API pagination documentation template that defines when to stop](https://githtml.com/guides/api-pagination-contract-template)
- [A rate-limit reference template that explains scope and recovery](https://githtml.com/guides/api-rate-limit-reference-template)
- [A backup restoration test record focused on evidence](https://githtml.com/guides/backup-restore-test-evidence-template)
- [A CLI command reference template with arguments and exit outcomes](https://githtml.com/guides/cli-command-reference-template)

Editorial approach: https://githtml.com/guides/about
