What does HTTP status code 500 mean?
The 500 Internal Server Error status code is the generic fallback error returned when the server encounters an unhandled exception or system failure.
When to use it in APIs
Returned automatically by application frameworks when code bugs, database server outages, or unhandled exceptions occur. Sanitized details should be logged, and a clean response returned.
How it compares to other codes
- 502 Bad Gateway: Implies a proxy gateway received an invalid response from an upstream application node. 500 represents a direct application crash.