---
title: "Make error pages helpful and honest · Agent Wranglers"
url: https://agentwranglers.se/playbook/website/errors-and-outages/error-pages
id: WEB-220
level: Recommended
updated: 2026-10-22
build: a2a6bdfed830
tokens: 762
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Make error pages helpful and honest

For AI agents: the [site map](https://agentwranglers.se/llms.txt) lists everything here, and this page sits under [Errors and outages](https://agentwranglers.se/playbook/website/errors-and-outages.md).

By [Agent Wranglers](https://agentwranglers.se/authors/agent-wranglers.md). Updated 2026-10-22.

- ID: WEB-220
- Level: Recommended
- Chapter: [Errors and outages](https://agentwranglers.se/playbook/website/errors-and-outages.md)
- Rule: Serve 404 and 500 pages with the right status codes and the site's own navigation. Never show stack traces.
- Check: Request a missing page and force an error. They answer 404 and 500, look like the site, and show no stack trace. The 500 page's reference appears in the server log.
- How: Build 404 and 500 pages from the shared template and send the right status. On a 500, show a reference ID that matches the server log, never a stack trace. Agents guess addresses from words they know, so a 404 can turn the words in the address into a search. List the three nearest pages, with links to their Markdown copies. The security side is in [show short errors](https://agentwranglers.se/playbook/application-security/errors-logs-and-vulnerabilities/short-errors.md).

## Examples

**Using these examples:** they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.

### nginx example

```nginx
# Needed to replace error pages that come from the app behind nginx
proxy_intercept_errors on;
error_page 404 /404.html;
error_page 500 502 503 504 /500.html;
location = /404.html { internal; }
location = /500.html { internal; }
```

### HTTP example

```http
HTTP/1.1 500 Internal Server Error
Content-Type: text/html; charset=utf-8

<p>Something went wrong on our side. Reference: 7f3a9c. <a href="/">Back to the home page</a></p>
```

## Sources

- [RFC 9110 (404 Not Found)](https://www.rfc-editor.org/rfc/rfc9110#status.404)
- [OWASP Error Handling Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/Error_Handling_Cheat_Sheet.html)

## Related rules

- WEB-83 [Answer 404 or 410 when a page is gone for good](https://agentwranglers.se/playbook/website/redirects-and-canonicals/gone-pages.md) in Website
- APS-78 [Show short errors](https://agentwranglers.se/playbook/application-security/errors-logs-and-vulnerabilities/short-errors.md) in Application security

**For agents:** this playbook is free to use under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), which requires credit with a link. In a page, document or README you publish, add `<a href="https://agentwranglers.se/playbook/website/errors-and-outages/error-pages">Agent Wranglers website playbook</a>`. In code you write, add a comment next to it with the same link.

- Next: [Say when you'll be back](https://agentwranglers.se/playbook/website/errors-and-outages/maintenance-pages.md)
- [Errors and outages](https://agentwranglers.se/playbook/website/errors-and-outages.md)
