Internal Server Error
ActiveHTTP 500 Internal Server Error indicates the server encountered an unexpected condition that prevented it from fulfilling the request. Defined in RFC 9110 §15.6.1. A generic catch-all for server-side failures.
Description
The 500 Internal Server Error status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the request.
This is a generic error response indicating the server knows something went wrong but cannot be more specific about the nature of the problem. When more specific server error codes are applicable (502, 503, 504), those should be used instead.
Servers should log detailed error information internally but avoid exposing stack traces or internal details to clients for security reasons.
Examples
GET /api/reports/generate HTTP/1.1
Host: api.example.comHTTP/1.1 500 Internal Server Error
Content-Type: application/json
{"error": "internal_error", "message": "An unexpected error occurred. Please try again later.", "request_id": "req_abc123"}Edge Cases
- •Never expose stack traces or internal error details in production 500 responses.
- •Include a request ID so support can correlate client errors with server logs.
- •500 errors should trigger alerting/monitoring — they indicate bugs, not user errors.
- •Some frameworks return 500 for unhandled exceptions by default.
When You'll See This
- →Unhandled exception in application code
- →Database connection failure
- →Null pointer / undefined reference in request handling
- →Out of memory on the server
Implementation References
| Language | Constant |
|---|---|
| Go | http.StatusInternalServerError |
| Rust | http::StatusCode::INTERNAL_SERVER_ERROR |
| Python | http.HTTPStatus.INTERNAL_SERVER_ERROR |
| Node.js | http.STATUS_CODES[500] |
| .NET | HttpStatusCode.InternalServerError |
| Java | HttpURLConnection.HTTP_INTERNAL_ERROR |
History
Present since HTTP/0.9 (1991). The generic server error. More specific 5xx codes (502, 503, 504) were added later to distinguish different failure modes.
Related Status Codes
FAQ
What causes a 500 Internal Server Error?
A 500 is caused by an unhandled error on the server — bugs in code, database failures, missing configuration, or resource exhaustion. It's never the client's fault.
How do I fix a 500 error?
Check server logs for the actual error. Look for the request ID in the response. Common causes: null references, database timeouts, misconfigured environment variables.