HTTP Error Codes

500 Internal Server Error

HTTP 500

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

What It Means

A 500 error is a generic "something went wrong" response. The server hit an error it wasn't prepared to handle. It's the server's fault, not the client's.

Common Causes

  • Unhandled exceptions — Code threw an error that wasn't caught
  • Database connection failure — Can't connect to the database
  • Configuration errors — Missing environment variables, bad config files
  • Memory/resource limits — Server ran out of memory or hit resource limits
  • Permission issues — Server process can't access needed files
  • Bad deployment — New code has bugs, missing dependencies

How to Debug

  1. Check server logs — The actual error is usually in the logs
  2. Check recent deploys — Did this start after a deployment?
  3. Check dependencies — Is the database up? External APIs responding?
  4. Check resource usage — CPU, memory, disk space
  5. Try to reproduce — What specific request triggers it?

Common Log Locations

# Nginx
/var/log/nginx/error.log

# Apache
/var/log/apache2/error.log

# Node.js (PM2)
~/.pm2/logs/app-error.log

# Docker
docker logs container_name

Prevention

  • Implement proper error handling and logging
  • Use health check endpoints to detect issues early
  • Set up uptime monitoring to catch 500s immediately
  • Use staging environments before deploying to production
  • Implement circuit breakers for external dependencies

For Visitors

If you're seeing this error as a user, it's not your fault. Try:

  • Refreshing the page
  • Waiting a few minutes and trying again
  • Checking the service's status page
  • Contacting support if the issue persists

How to Monitor for 500 Errors

500 errors often go unnoticed until users complain. UptimeSignal monitors your endpoints every 1-5 minutes and alerts you the moment a 500 error is detected. Combine with application-level error tracking for complete coverage. See also: 502 Bad Gateway, 503 Service Unavailable, and 504 Gateway Timeout.

Frequently Asked Questions

What causes a 500 Internal Server Error?
A 500 error is a generic server-side error caused by unhandled exceptions, database connection failures, missing environment variables, permission issues, memory limits, or bad deployments. The server logs contain the actual error message -- the 500 response just tells the client "something broke."
How do I fix a 500 Internal Server Error?
Check server logs first: Nginx (/var/log/nginx/error.log), Apache (/var/log/apache2/error.log), or your app's log output. The log will show the exact exception. Common fixes: fix code bugs, restore database connections, add missing env vars, or roll back a bad deployment.
Is a 500 error the user's fault?
No. A 500 error is always a server-side issue. While a user's specific request may trigger the bug, the server is responsible for handling all inputs gracefully. If you're seeing this as a visitor, try refreshing, waiting a few minutes, or checking the service's status page.
What is the difference between 500, 502, 503, and 504?
500 = unexpected server error. 502 = proxy got invalid upstream response. 503 = server temporarily overloaded. 504 = proxy timed out waiting for upstream. All are server-side, but they have different root causes and fixes.
How do I prevent 500 errors?
Implement proper error handling (try/catch), use health check endpoints, set up uptime monitoring, deploy via staging environments first, implement circuit breakers for external dependencies, and set up application-level error tracking (Sentry, Bugsnag). Test edge cases before production.

Stop finding out about 500 errors from your users

UptimeSignal detects server errors within minutes and alerts you before customers notice.

Monitor response codes on all your endpoints. 25 monitors free, unlimited for $15/month.

Related Errors & Resources