Internal Server Error
5xx Server Error
Last updated:
A generic error message given when an unexpected condition was encountered on the server.
Description
The catch-all for 'something broke and we don't have a more specific code'. In practice, most unhandled exceptions in web frameworks bubble up as 500s.
When to use
Return 500 for unexpected exceptions. For expected failure modes, prefer more specific 5xx codes.
Common pitfalls
Do not leak stack traces in the response body — that's an information disclosure vulnerability.
Specification
RFC 9110 §15.6.1
Examples
HTTP/1.1 500 Internal Server Error
Content-Type: application/json
{"error":"Internal Server Error"}res.status(500).json({ error: "Internal Server Error" });w.WriteHeader(http.StatusInternalServerError)
return jsonify({"error": "Internal Server Error"}), 500Related status codes
Bad Gateway
The server, acting as a gateway or proxy, received an invalid response from the upstream server.
Service Unavailable
The server is currently unable to handle the request due to temporary overloading or maintenance.
Gateway Timeout
The server, acting as a gateway or proxy, did not receive a response from the upstream server in time.