DevKits
500

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 response
HTTP/1.1 500 Internal Server Error
Content-Type: application/json

{"error":"Internal Server Error"}
Node.js (Express)
res.status(500).json({ error: "Internal Server Error" });
Go (net/http)
w.WriteHeader(http.StatusInternalServerError)
Python (Flask)
return jsonify({"error": "Internal Server Error"}), 500

Related status codes

All 5xx codes