HTTP Error Codes
Overview
This reference helps map common HTTP responses to the layer most likely responsible.
Why It Matters
The status code is often the fastest clue to where the failure happened.
Core Concepts
2xxis success, but the UI can still be wrong.4xxusually means a request, auth, or validation problem.5xxusually means backend, proxy, or dependency trouble.
Mental Models
Start with the status code, then inspect the request, response body, and the boundary that owns the failure.
Best Practices
- Check method, URL, status, and body together.
- Verify redirects and caching.
- Use logs when the code alone is not enough.
Common Mistakes
- Assuming all
200responses are good. - Treating all
500errors as identical. - Ignoring redirects and cache behavior.
Trade-offs
Status codes are quick triage signals, not full diagnosis. They point you at the right layer.
Decision Framework
| Range | Usual meaning | First check |
|---|---|---|
2xx | Success, maybe broken UI | State or rendering |
3xx | Redirect | Routing, auth, cache |
4xx | Client issue | Payload, auth, validation |
5xx | Server issue | Logs, dependencies |
Examples
| Code | Meaning | Typical frontend clue |
|---|---|---|
200 | OK | UI state or data mapping issue |
401 | Unauthorized | Auth session or token issue |
403 | Forbidden | Permission or role issue |
404 | Not found | Route or resource mismatch |
422 | Validation failed | Form or payload mismatch |
429 | Rate limited | Retry or throttling issue |
500 | Internal server error | Backend exception |
502 | Bad gateway | Proxy or upstream failure |
503 | Service unavailable | Deployment or maintenance |
504 | Gateway timeout | Slow dependency or database |
Checklists
- Did I capture the exact status code?
- Did I inspect the body and headers?
- Do I know which layer owns the issue?
Senior Engineer Notes
Senior engineers use status codes to shrink the search space quickly. The code is the clue, not the conclusion.