5xx Server Errors

HTTP 500 Internal Server Error

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

When is 500 used?

  • Unhandled exceptions
  • Application crashes
  • Configuration errors

How to handle a 500 response

The problem is on the server side. Check server and proxy logs, retry idempotent requests with exponential backoff, and alert on sustained 5xx rates.

Check the status code a URL returns from the command line:

curl -s -o /dev/null -w "%{http_code}\n" https://example.com

How to return 500 from your server

Node.js (Express)

res.status(500).json({ message: 'Internal Server Error' });

Python (Flask)

return {"message": "Internal Server Error"}, 500

Go (net/http)

w.WriteHeader(500)

Frequently Asked Questions

What does HTTP 500 mean?

500 Internal Server Error: The server encountered an unexpected condition that prevented it from fulfilling the request.

Is 500 an error?

Yes. 500 is in the 5xx Server Errors class. Server errors: the server failed to fulfil an apparently valid request.