500 Internal Server Error

HTTP response status code 500 Internal Server Error is a catch-all server error message that is generic in nature and generally used if a more specific one is not available.

Usage

When the 500 Internal Server Error status code is received, it indicates a generic error on the server side. Due to the generic nature of this error, it is situational and also depends on the environment. Basically, it means that the webserver is having problems and the user is unable to resolve the error and the server administrator needs to take action on the server-side to fix the error.

The error can for example be attributed on the server-side to a permissions error on one or more files or folders, a PHP timeout, or corruption in the .htaccess file. However, the only thing certain is that the HTTP request cannot be fulfilled.

Example

In the example, the client requests a resource and the server responds with a 500 Internal Server Error status code, meaning simply that the HTTP request will not be satisfied.

Request

GET /news.html HTTP/1.1
Host: www.example.re

Response

HTTP/1.1 500 Internal Server Error
Content-Type: text/html; charset=UTF-8
Content-Length: 153

<html>
  <head>
    <title>Request Failed<\title>
  </head>
  <body>
    <p>Your request cannot be completed due to a server error.</p>
  </body>
</html>

Code references

.NET

HttpStatusCode.InternalServerError

Rust

http::StatusCode::INTERNAL_SERVER_ERROR

Rails

:internal_server_error

Go

http.StatusInternalServerError

Symfony

Response::HTTP_INTERNAL_SERVER_ERROR

Python3.5+

http.HTTPStatus.INTERNAL_SERVER_ERROR

Java

java.net.HttpURLConnection.HTTP_INTERNAL_ERROR

Apache HttpComponents Core

org.apache.hc.core5.http.HttpStatus.SC_SERVER_ERROR
org.apache.hc.core5.http.HttpStatus.SC_INTERNAL_SERVER_ERROR

Angular

@angular/common/http/HttpStatusCode.InternalServerError

Takeaway

The 500 Internal Server Error status code is a catch-all server error and the HTTP request can not be fulfilled.

See also

Last updated: August 2, 2023