500 Internal Server Error: what it means
The server hit something it did not expect and could not finish the request. It is the catch-all for failures on the server side: the request was fine, the code or the configuration behind it was not. A 500 says nothing about what broke, so the answer is always in the server's own log.
The code belongs to the 5xx class and its official name is "Internal Server Error". The page opens the status code list on 500, so you can compare it with its neighbours.
What the response looks like
HTTP/1.1 500 Internal Server Error
Content-Type: application/json
Content-Length: 31Common causes
- An unhandled exception in the application code, often after a deploy.
- A syntax error in a configuration file, such as .htaccess or an nginx include.
- The database is down, refused the connection or ran out of connections.
- The process ran out of memory or the disk is full, so it cannot write logs or sessions.
- A plugin or dependency that is incompatible with the runtime version, typical in WordPress after an update.
How to fix it
If you are a visitor
- Reload after a minute: a deploy or a restart often fixes itself.
- Do not resubmit a payment or order form; check first whether the action went through.
- If it lasts, tell the site's support the time and the page: that lets them find the line in the log.
If you run the site or the API
- Read the log, not the browser: the nginx error log, the Apache error_log or the application log has the stack trace.
- Reproduce it with curl -v so cookies and extensions are out of the picture.
- Roll back the last deploy or configuration change and see whether the error goes away.
- Check free disk, memory and the database connection count; test the config with nginx -t before reloading.
Snippets to copy
Express: log the real error, answer with a short one
app.use((err, req, res, next) => {
console.error(err); // the stack trace stays in the log
res.status(500).json({ error: 'internal_error' });
});Where to look first
sudo tail -n 50 /var/log/nginx/error.log
sudo journalctl -u myapp --since "10 min ago"
df -h && free -mCodes it is confused with
| Code | Difference |
|---|---|
| 502 Bad Gateway | A proxy got an invalid answer from the server behind it. |
| 503 Service Unavailable | The server is temporarily unable to serve, such as overloaded or in maintenance. |
| 504 Gateway Timeout | The proxy waited too long for the server behind it. |
| 501 Not Implemented | The server does not support the method of the request at all. |
Caching, retries and search engines
Clients may retry a 500 on idempotent requests (GET, PUT, DELETE) with exponential backoff; for a POST, retry only if the API offers an idempotency key. Never show the stack trace to users: it leaks paths, versions and sometimes secrets.
Look up other status codes
- Open the list and type a number (404) or a word (timeout) in the search box.
- Read the description of the code and copy "500 Internal Server Error" with the button on its card.
- Use the # button to copy a link straight to that code.
Frequently asked questions
Is a 500 error my fault as a visitor?
Almost never. The 5xx class means the failure is on the server, so there is nothing to fix in your browser. Wait and retry, or report it to the site.
How do I find the cause of a 500 on WordPress?
Turn on WP_DEBUG_LOG in wp-config.php and read wp-content/debug.log; if the site is unreachable, rename the plugins folder to disable them all and add them back one by one.
What is the difference between 500 and 503?
500 is an unexpected failure. 503 is a known, temporary inability to serve (maintenance, overload) and may carry a Retry-After header that says when to come back.