HTTPError.net

The fastest way to diagnose, understand, and fix any HTTP status code

500 Internal Server Error

Fault: Server
TL;DR

Generic server error when no specific error code is appropriate.

The server encountered an unexpected condition that prevented it from fulfilling the request.

What HTTP 500 Internal Server Error Means

The server encountered an unexpected condition that prevented it from fulfilling the request.

Generic server error when no specific error code is appropriate.

Common Causes

How to Fix It (For Visitors)

How to Fix It (For Developers/Admins)

Returning a 500 Internal Server Error (Code Examples)

If you build APIs or web apps, here is how to send an HTTP 500 response and how to test for it:

Node.js (Express)

app.get('/resource', (req, res) => {
  res.status(500).json({ error: 'Internal Server Error' });
});

Python (Flask)

@app.route('/resource')
def resource():
    return jsonify(error='Internal Server Error'), 500

PHP

<?php
http_response_code(500);
header('Content-Type: application/json');
echo json_encode(['error' => 'Internal Server Error']);

Check the status with curl

curl -I https://example.com/resource
# Look for: HTTP/1.1 500 Internal Server Error

Frequently Asked Questions

What does HTTP 500 Internal Server Error mean?

Generic server error when no specific error code is appropriate. In short: The server encountered an unexpected condition that prevented it from fulfilling the request.

Is a 500 Internal Server Error error my fault or the website's?

500 is a 5xx server-error code, so the problem is on the server side, not your browser or device. As a visitor you can usually only retry; if you run the site, investigate the server.

How do I fix a 500 Internal Server Error error?

Check error logs. Debug application code. Verify database connectivity.

Official Specification

The 500 Internal Server Error status code is defined in RFC 7231 Section 6.6.1.

View the IANA HTTP Status Code Registry →