Skip to main content
500

Internal Server Error

Active
RFC 9110 §15.6.1Since 1991Web, APIs, Servers

HTTP 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

Request
http
GET /api/reports/generate HTTP/1.1
Host: api.example.com
500 response
http
HTTP/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

LanguageConstant
Gohttp.StatusInternalServerError
Rusthttp::StatusCode::INTERNAL_SERVER_ERROR
Pythonhttp.HTTPStatus.INTERNAL_SERVER_ERROR
Node.jshttp.STATUS_CODES[500]
.NETHttpStatusCode.InternalServerError
JavaHttpURLConnection.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.